<!doctype html><html lang="en">
 <head>
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
  <title>File API</title>
  <link href="https://www.w3.org/TR/FileAPI/" rel="canonical">
<style>/* style-md-lists */

/* This is a weird hack for me not yet following the commonmark spec
   regarding paragraph and lists. */
[data-md] > :first-child {
    margin-top: 0;
}
[data-md] > :last-child {
    margin-bottom: 0;
}</style>
<style>/* style-selflinks */

.heading, .issue, .note, .example, li, dt {
    position: relative;
}
a.self-link {
    position: absolute;
    top: 0;
    left: calc(-1 * (3.5rem - 26px));
    width: calc(3.5rem - 26px);
    height: 2em;
    text-align: center;
    border: none;
    transition: opacity .2s;
    opacity: .5;
}
a.self-link:hover {
    opacity: 1;
}
.heading > a.self-link {
    font-size: 83%;
}
li > a.self-link {
    left: calc(-1 * (3.5rem - 26px) - 2em);
}
dfn > a.self-link {
    top: auto;
    left: auto;
    opacity: 0;
    width: 1.5em;
    height: 1.5em;
    background: gray;
    color: white;
    font-style: normal;
    transition: opacity .2s, background-color .2s, color .2s;
}
dfn:hover > a.self-link {
    opacity: 1;
}
dfn > a.self-link:hover {
    color: black;
}

a.self-link::before            { content: "¶"; }
.heading > a.self-link::before { content: "§"; }
dfn > a.self-link::before      { content: "#"; }</style>
<style>/* style-counters */

body {
    counter-reset: example figure issue;
}
.issue {
    counter-increment: issue;
}
.issue:not(.no-marker)::before {
    content: "Issue " counter(issue);
}

.example {
    counter-increment: example;
}
.example:not(.no-marker)::before {
    content: "Example " counter(example);
}
.invalid.example:not(.no-marker)::before,
.illegal.example:not(.no-marker)::before {
    content: "Invalid Example" counter(example);
}

figcaption {
    counter-increment: figure;
}
figcaption:not(.no-marker)::before {
    content: "Figure " counter(figure) " ";
}</style>
<style>/* style-var-click-highlighting */

    var { cursor: pointer; }
    var.selected0 { background-color: #F4D200; box-shadow: 0 0 0 2px #F4D200; }
    var.selected1 { background-color: #FF87A2; box-shadow: 0 0 0 2px #FF87A2; }
    var.selected2 { background-color: #96E885; box-shadow: 0 0 0 2px #96E885; }
    var.selected3 { background-color: #3EEED2; box-shadow: 0 0 0 2px #3EEED2; }
    var.selected4 { background-color: #EACFB6; box-shadow: 0 0 0 2px #EACFB6; }
    var.selected5 { background-color: #82DDFF; box-shadow: 0 0 0 2px #82DDFF; }
    var.selected6 { background-color: #FFBCF2; box-shadow: 0 0 0 2px #FFBCF2; }
    </style>
<style>/* style-autolinks */

.css.css, .property.property, .descriptor.descriptor {
    color: #005a9c;
    font-size: inherit;
    font-family: inherit;
}
.css::before, .property::before, .descriptor::before {
    content: "‘";
}
.css::after, .property::after, .descriptor::after {
    content: "’";
}
.property, .descriptor {
    /* Don't wrap property and descriptor names */
    white-space: nowrap;
}
.type { /* CSS value <type> */
    font-style: italic;
}
pre .property::before, pre .property::after {
    content: "";
}
[data-link-type="property"]::before,
[data-link-type="propdesc"]::before,
[data-link-type="descriptor"]::before,
[data-link-type="value"]::before,
[data-link-type="function"]::before,
[data-link-type="at-rule"]::before,
[data-link-type="selector"]::before,
[data-link-type="maybe"]::before {
    content: "‘";
}
[data-link-type="property"]::after,
[data-link-type="propdesc"]::after,
[data-link-type="descriptor"]::after,
[data-link-type="value"]::after,
[data-link-type="function"]::after,
[data-link-type="at-rule"]::after,
[data-link-type="selector"]::after,
[data-link-type="maybe"]::after {
    content: "’";
}

[data-link-type].production::before,
[data-link-type].production::after,
.prod [data-link-type]::before,
.prod [data-link-type]::after {
    content: "";
}

[data-link-type=element],
[data-link-type=element-attr] {
    font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;
    font-size: .9em;
}
[data-link-type=element]::before { content: "<" }
[data-link-type=element]::after  { content: ">" }

[data-link-type=biblio] {
    white-space: pre;
}</style>
<style>/* style-dfn-panel */

.dfn-panel {
    position: absolute;
    z-index: 35;
    height: auto;
    width: -webkit-fit-content;
    width: fit-content;
    max-width: 300px;
    max-height: 500px;
    overflow: auto;
    padding: 0.5em 0.75em;
    font: small Helvetica Neue, sans-serif, Droid Sans Fallback;
    background: #DDDDDD;
    color: black;
    border: outset 0.2em;
}
.dfn-panel:not(.on) { display: none; }
.dfn-panel * { margin: 0; padding: 0; text-indent: 0; }
.dfn-panel > b { display: block; }
.dfn-panel a { color: black; }
.dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; }
.dfn-panel > b + b { margin-top: 0.25em; }
.dfn-panel ul { padding: 0; }
.dfn-panel li { list-style: inside; }
.dfn-panel.activated {
    display: inline-block;
    position: fixed;
    left: .5em;
    bottom: 2em;
    margin: 0 auto;
    max-width: calc(100vw - 1.5em - .4em - .5em);
    max-height: 30vh;
}

.dfn-paneled { cursor: pointer; }
</style>
<style>/* style-syntax-highlighting */
pre.idl.highlight { color: #708090; }
.highlight:not(.idl) { background: hsl(24, 20%, 95%); }
code.highlight { padding: .1em; border-radius: .3em; }
pre.highlight, pre > code.highlight { display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; }
c-[a] { color: #990055 } /* Keyword.Declaration */
c-[b] { color: #990055 } /* Keyword.Type */
c-[c] { color: #708090 } /* Comment */
c-[d] { color: #708090 } /* Comment.Multiline */
c-[e] { color: #0077aa } /* Name.Attribute */
c-[f] { color: #669900 } /* Name.Tag */
c-[g] { color: #222222 } /* Name.Variable */
c-[k] { color: #990055 } /* Keyword */
c-[l] { color: #000000 } /* Literal */
c-[m] { color: #000000 } /* Literal.Number */
c-[n] { color: #0077aa } /* Name */
c-[o] { color: #999999 } /* Operator */
c-[p] { color: #999999 } /* Punctuation */
c-[s] { color: #a67f59 } /* Literal.String */
c-[t] { color: #a67f59 } /* Literal.String.Single */
c-[u] { color: #a67f59 } /* Literal.String.Double */
c-[cp] { color: #708090 } /* Comment.Preproc */
c-[c1] { color: #708090 } /* Comment.Single */
c-[cs] { color: #708090 } /* Comment.Special */
c-[kc] { color: #990055 } /* Keyword.Constant */
c-[kn] { color: #990055 } /* Keyword.Namespace */
c-[kp] { color: #990055 } /* Keyword.Pseudo */
c-[kr] { color: #990055 } /* Keyword.Reserved */
c-[ld] { color: #000000 } /* Literal.Date */
c-[nc] { color: #0077aa } /* Name.Class */
c-[no] { color: #0077aa } /* Name.Constant */
c-[nd] { color: #0077aa } /* Name.Decorator */
c-[ni] { color: #0077aa } /* Name.Entity */
c-[ne] { color: #0077aa } /* Name.Exception */
c-[nf] { color: #0077aa } /* Name.Function */
c-[nl] { color: #0077aa } /* Name.Label */
c-[nn] { color: #0077aa } /* Name.Namespace */
c-[py] { color: #0077aa } /* Name.Property */
c-[ow] { color: #999999 } /* Operator.Word */
c-[mb] { color: #000000 } /* Literal.Number.Bin */
c-[mf] { color: #000000 } /* Literal.Number.Float */
c-[mh] { color: #000000 } /* Literal.Number.Hex */
c-[mi] { color: #000000 } /* Literal.Number.Integer */
c-[mo] { color: #000000 } /* Literal.Number.Oct */
c-[sb] { color: #a67f59 } /* Literal.String.Backtick */
c-[sc] { color: #a67f59 } /* Literal.String.Char */
c-[sd] { color: #a67f59 } /* Literal.String.Doc */
c-[se] { color: #a67f59 } /* Literal.String.Escape */
c-[sh] { color: #a67f59 } /* Literal.String.Heredoc */
c-[si] { color: #a67f59 } /* Literal.String.Interpol */
c-[sx] { color: #a67f59 } /* Literal.String.Other */
c-[sr] { color: #a67f59 } /* Literal.String.Regex */
c-[ss] { color: #a67f59 } /* Literal.String.Symbol */
c-[vc] { color: #0077aa } /* Name.Variable.Class */
c-[vg] { color: #0077aa } /* Name.Variable.Global */
c-[vi] { color: #0077aa } /* Name.Variable.Instance */
c-[il] { color: #000000 } /* Literal.Number.Integer.Long */
</style>
  <link href="https://www.w3.org/StyleSheets/TR/2016/W3C-ED" rel="stylesheet">
 <body class="h-entry">
  <div class="head">
   <p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C" width="72"> </a> </p>
   <h1 class="p-name no-ref" id="title">File API</h1>
   <h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft, <time class="dt-updated" datetime="1970-01-01">1 January 1970</time></span></h2>
   <div data-fill-with="spec-metadata">
    <dl>
     <dt>This version:
     <dd><a class="u-url" href="https://w3c.github.io/FileAPI/">https://w3c.github.io/FileAPI/</a>
     <dt>Latest published version:
     <dd><a href="https://www.w3.org/TR/FileAPI/">https://www.w3.org/TR/FileAPI/</a>
     <dt>Previous Versions:
     <dd><a href="https://www.w3.org/TR/2019/WD-FileAPI-20190531/" rel="prev">https://www.w3.org/TR/2019/WD-FileAPI-20190531/</a>
     <dt class="editor">Editor:
     <dd class="editor p-author h-card vcard" data-editor-id="72440"><a class="p-name fn u-email email" href="mailto:mek@chromium.org">Marijn Kruisselbrink</a> (<span class="p-org org">Google</span>)
     <dt class="editor">Former Editor:
     <dd class="editor p-author h-card vcard" data-editor-id="37240"><a class="p-name fn u-url url" href="http://arunranga.com/">Arun Ranganathan</a> (<span class="p-org org">Mozilla Corporation</span>) <a class="u-email email" href="mailto:arun@mozilla.com">arun@mozilla.com</a>
     <dt>Tests:
     <dd><a href="https://github.com/web-platform-tests/wpt/tree/master/FileAPI">web-platform-tests FileAPI/</a> (<a href="https://github.com/web-platform-tests/wpt/labels/FileAPI">ongoing work</a>)
    </dl>
   </div>
   <div data-fill-with="warning"></div>
   <p class="copyright" data-fill-with="copyright"><a href="https://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 1970 <a href="https://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="https://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="https://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="https://www.keio.ac.jp/">Keio</a>, <a href="https://ev.buaa.edu.cn/">Beihang</a>). W3C <a href="https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document" rel="license">permissive document license</a> rules apply. </p>
   <hr title="Separator for header">
  </div>
  <div class="p-summary" data-fill-with="abstract">
   <h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
   <p>This specification provides an API for representing file objects in web applications,

  as well as programmatically selecting them and accessing their data. This includes:</p>
   <ul>
    <li data-md>
     <p>A <code class="idl"><a data-link-type="idl" href="#dfn-filelist" id="ref-for-dfn-filelist">FileList</a></code> interface, which represents an array of individually selected files from the underlying system. The user interface for selection can be invoked via <code>&lt;input type="file"></code>, i.e. when the input element is in the <code>File Upload</code> state <a data-link-type="biblio" href="#biblio-html">[HTML]</a>.</p>
    <li data-md>
     <p>A <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob">Blob</a></code> interface, which represents immutable raw binary data, and allows access to ranges of bytes within the <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob①">Blob</a></code> object as a separate <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob②">Blob</a></code>.</p>
    <li data-md>
     <p>A <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file">File</a></code> interface, which includes readonly informational attributes about a file such as its name and the date of the last modification (on disk) of the file.</p>
    <li data-md>
     <p>A <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader">FileReader</a></code> interface, which provides methods to read a <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file①">File</a></code> or a <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob③">Blob</a></code>, and an event model to obtain the results of these reads.</p>
    <li data-md>
     <p>A <a href="#url">URL scheme</a> for use with binary data such as files, so that they can be referenced within web applications.</p>
   </ul>
   <p>Additionally, this specification defines objects to be used within threaded web applications for the synchronous reading of files.</p>
   <p><a href="#requirements">§ 10 Requirements and Use Cases</a> covers the motivation behind this specification.</p>
   <p>This API is designed to be used in conjunction with other APIs and elements on the web platform, notably: <code class="idl"><a data-link-type="idl" href="https://xhr.spec.whatwg.org/#xmlhttprequest" id="ref-for-xmlhttprequest">XMLHttpRequest</a></code> (e.g. with an overloaded <code class="idl"><a data-link-type="idl" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send" id="ref-for-dom-xmlhttprequest-send">send()</a></code> method for <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file②">File</a></code> or <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob④">Blob</a></code> arguments), <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/workers.html#dom-worker-postmessage-options" id="ref-for-dom-worker-postmessage-options">postMessage()</a></code>, <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/dnd.html#datatransfer" id="ref-for-datatransfer">DataTransfer</a></code> (part of the drag and drop API defined in <a data-link-type="biblio" href="#biblio-html">[HTML]</a>)
  and Web Workers.
  Additionally, it should be possible to programmatically obtain a list of files from the <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/input.html#the-input-element" id="ref-for-the-input-element">input</a></code> element
  when it is in the <code>File Upload</code> state <a data-link-type="biblio" href="#biblio-html">[HTML]</a>.
  These kinds of behaviors are defined in the appropriate affiliated specifications.</p>
  </div>
  <h2 class="no-num no-toc no-ref heading settled" id="status"><span class="content">Status of this document</span></h2>
  <div data-fill-with="status">
   <p> <em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision of this technical report can be found in the <a href="https://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports index</a> at https://www.w3.org/TR/.</em> </p>
   <p> This document was published by the <a href="https://www.w3.org/2019/webapps/">Web Applications Working Group</a> as an Editors Draft. This document is intended to become a W3C Recommendation. </p>
   <p></p>
   <p>Previous discussion of this specification has taken place on two other mailing lists: <a href="mailto:public-webapps@w3.org">public-webapps@w3.org</a> (<a href="https://lists.w3.org/Archives/Public/public-webapps/">archive</a>) and <a href="mailto:public-webapi@w3.org">public-webapi@w3.org</a> (<a href="https://lists.w3.org/Archives/Public/public-webapi/">archive</a>). Ongoing discussion will be on the <a href="mailto:public-webapps@w3.org">public-webapps@w3.org</a> mailing list.</p>
   <p>This draft consists of changes made to the previous Last Call Working Draft. Please send comments to the <a href="mailto:public-webapi@w3.org">public-webapi@w3.org</a> as described above. You can see Last Call Feedback on the W3C Wiki: <a href="https://www.w3.org/wiki/Webapps/LCWD-FileAPI-20130912">https://www.w3.org/wiki/Webapps/LCWD-FileAPI-20130912</a></p>
   <p>An <a href="https://wpt.fyi/results/FileAPI">implementation report</a> is automatically generated from the test suite.</p>
   <p></p>
   <p> This document was published by the <a href="https://www.w3.org/2019/webapps/">Web Applications Working Group</a> as a Working Draft.

    Feedback and comments on this specification are welcome. Please use <a href="https://github.com/w3c/FileAPI/issues">GitHub issues</a> Historical discussions can be found in the <a href="https://lists.w3.org/Archives/Public/public-webapps/">public-webapps@w3.org archives</a>. </p>
   <p> Publication as an Editors Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr> Membership. This is a draft document and may
    be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite
    this document as other than work in progress. </p>
   <p> This document was produced by a group operating under the <a href="https://www.w3.org/Consortium/Patent-Policy/"><abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>. <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="https://www.w3.org/2004/01/pp-impl/114929/status" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="https://www.w3.org/Consortium/Patent-Policy/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="https://www.w3.org/Consortium/Patent-Policy/#sec-Disclosure">section 6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>. </p>
   <p>This document is governed by the <a href="https://www.w3.org/2019/Process-20190301/" id="w3c_process_revision">1 March 2019 W3C Process Document</a>. </p>
  </div>
  <div data-fill-with="at-risk"></div>
  <nav data-fill-with="table-of-contents" id="toc">
   <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
   <ol class="toc" role="directory">
    <li><a href="#intro"><span class="secno">1</span> <span class="content">Introduction</span></a>
    <li><a href="#terminology"><span class="secno">2</span> <span class="content">Terminology and Algorithms</span></a>
    <li>
     <a href="#blob-section"><span class="secno">3</span> <span class="content">The Blob Interface and Binary Data</span></a>
     <ol class="toc">
      <li>
       <a href="#constructorBlob"><span class="secno">3.1</span> <span class="content">Constructors</span></a>
       <ol class="toc">
        <li><a href="#constructorParams"><span class="secno">3.1.1</span> <span class="content">Constructor Parameters</span></a>
       </ol>
      <li><a href="#attributes-blob"><span class="secno">3.2</span> <span class="content">Attributes</span></a>
      <li>
       <a href="#methodsandparams-blob"><span class="secno">3.3</span> <span class="content">Methods and Parameters</span></a>
       <ol class="toc">
        <li><a href="#slice-method-algo"><span class="secno">3.3.1</span> <span class="content">The <code class="idl"><span>slice()</span></code> method</span></a>
        <li><a href="#stream-method-algo"><span class="secno">3.3.2</span> <span class="content">The <code class="idl"><span>stream()</span></code> method</span></a>
        <li><a href="#text-method-algo"><span class="secno">3.3.3</span> <span class="content">The <code class="idl"><span>text()</span></code> method</span></a>
        <li><a href="#arraybuffer-method-algo"><span class="secno">3.3.4</span> <span class="content">The <code class="idl"><span>arrayBuffer()</span></code> method</span></a>
       </ol>
     </ol>
    <li>
     <a href="#file-section"><span class="secno">4</span> <span class="content">The File Interface</span></a>
     <ol class="toc">
      <li>
       <a href="#file-constructor"><span class="secno">4.1</span> <span class="content">Constructor</span></a>
       <ol class="toc">
        <li><a href="#file-constructor-params"><span class="secno">4.1.1</span> <span class="content">Constructor Parameters</span></a>
       </ol>
      <li><a href="#file-attrs"><span class="secno">4.2</span> <span class="content">Attributes</span></a>
     </ol>
    <li>
     <a href="#filelist-section"><span class="secno">5</span> <span class="content">The FileList Interface</span></a>
     <ol class="toc">
      <li><a href="#attributes-filelist"><span class="secno">5.1</span> <span class="content">Attributes</span></a>
      <li><a href="#filelist-methods-params"><span class="secno">5.2</span> <span class="content">Methods and Parameters</span></a>
     </ol>
    <li>
     <a href="#reading-data-section"><span class="secno">6</span> <span class="content">Reading Data</span></a>
     <ol class="toc">
      <li><a href="#blobreader-task-source"><span class="secno">6.1</span> <span class="content">The File Reading Task Source</span></a>
      <li>
       <a href="#APIASynch"><span class="secno">6.2</span> <span class="content">The <code class="idl"><span>FileReader</span></code> API</span></a>
       <ol class="toc">
        <li><a href="#event-handler-attributes-section"><span class="secno">6.2.1</span> <span class="content">Event Handler Content Attributes</span></a>
        <li><a href="#blobreader-state"><span class="secno">6.2.2</span> <span class="content">FileReader States</span></a>
        <li>
         <a href="#reading-a-file"><span class="secno">6.2.3</span> <span class="content">Reading a File or Blob</span></a>
         <ol class="toc">
          <li><a href="#readAsDataURL"><span class="secno">6.2.3.1</span> <span class="content">The <code class="idl"><span>readAsDataURL()</span></code> method</span></a>
          <li><a href="#readAsDataText"><span class="secno">6.2.3.2</span> <span class="content">The <code class="idl"><span>readAsText()</span></code> method</span></a>
          <li><a href="#readAsArrayBuffer"><span class="secno">6.2.3.3</span> <span class="content">The <code class="idl"><span>readAsArrayBuffer()</span></code></span></a>
          <li><a href="#readAsBinaryString"><span class="secno">6.2.3.4</span> <span class="content">The <code class="idl"><span>readAsBinaryString()</span></code> method</span></a>
          <li><a href="#abort"><span class="secno">6.2.3.5</span> <span class="content">The <code class="idl"><span>abort()</span></code> method</span></a>
         </ol>
       </ol>
      <li><a href="#packaging-data"><span class="secno">6.3</span> <span class="content">Packaging data</span></a>
      <li>
       <a href="#events"><span class="secno">6.4</span> <span class="content">Events</span></a>
       <ol class="toc">
        <li><a href="#event-summary"><span class="secno">6.4.1</span> <span class="content">Event Summary</span></a>
        <li><a href="#eventInvariants"><span class="secno">6.4.2</span> <span class="content">Summary of Event Invariants</span></a>
       </ol>
      <li>
       <a href="#readingOnThreads"><span class="secno">6.5</span> <span class="content">Reading on Threads</span></a>
       <ol class="toc">
        <li>
         <a href="#FileReaderSync"><span class="secno">6.5.1</span> <span class="content">The <code class="idl"><span>FileReaderSync</span></code> API</span></a>
         <ol class="toc">
          <li><a href="#filereadersyncConstrctr"><span class="secno">6.5.1.1</span> <span class="content">Constructors</span></a>
          <li><a href="#readAsTextSync"><span class="secno">6.5.1.2</span> <span class="content">The <code class="idl"><span>readAsText()</span></code></span></a>
          <li><a href="#readAsDataURLSync-section"><span class="secno">6.5.1.3</span> <span class="content">The <code class="idl"><span>readAsDataURL()</span></code> method</span></a>
          <li><a href="#readAsArrayBufferSyncSection"><span class="secno">6.5.1.4</span> <span class="content">The <code class="idl"><span>readAsArrayBuffer()</span></code> method</span></a>
          <li><a href="#readAsBinaryStringSyncSection"><span class="secno">6.5.1.5</span> <span class="content">The <code class="idl"><span>readAsBinaryString()</span></code> method</span></a>
         </ol>
       </ol>
     </ol>
    <li>
     <a href="#ErrorAndException"><span class="secno">7</span> <span class="content">Errors and Exceptions</span></a>
     <ol class="toc">
      <li><a href="#dfn-error-codes"><span class="secno">7.1</span> <span class="content">Throwing an Exception or Returning an Error</span></a>
     </ol>
    <li>
     <a href="#url"><span class="secno">8</span> <span class="content">A URL for Blob and MediaSource reference</span></a>
     <ol class="toc">
      <li><a href="#url-intro"><span class="secno">8.1</span> <span class="content">Introduction</span></a>
      <li><a href="#url-model"><span class="secno">8.2</span> <span class="content">Model</span></a>
      <li>
       <a href="#requestResponseModel"><span class="secno">8.3</span> <span class="content">Dereferencing Model for blob URLs</span></a>
       <ol class="toc">
        <li><a href="#originOfBlobURL"><span class="secno">8.3.1</span> <span class="content">Origin of blob URLs</span></a>
        <li><a href="#lifeTime"><span class="secno">8.3.2</span> <span class="content">Lifetime of blob URLs</span></a>
       </ol>
      <li>
       <a href="#creating-revoking"><span class="secno">8.4</span> <span class="content">Creating and Revoking a blob URL</span></a>
       <ol class="toc">
        <li><a href="#examplesOfCreationRevocation"><span class="secno">8.4.1</span> <span class="content">Examples of blob URL Creation and Revocation</span></a>
       </ol>
     </ol>
    <li><a href="#security-discussion"><span class="secno">9</span> <span class="content">Security and Privacy Considerations</span></a>
    <li><a href="#requirements"><span class="secno">10</span> <span class="content">Requirements and Use Cases</span></a>
    <li><a href="#acknowledgements-section"><span class="secno"></span> <span class="content"> Acknowledgements</span></a>
    <li>
     <a href="#conformance"><span class="secno"></span> <span class="content">Conformance</span></a>
     <ol class="toc">
      <li><a href="#conventions"><span class="secno"></span> <span class="content">Document conventions</span></a>
      <li><a href="#conformant-algorithms"><span class="secno"></span> <span class="content">Conformant Algorithms</span></a>
     </ol>
    <li>
     <a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
     <ol class="toc">
      <li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
      <li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
     </ol>
    <li>
     <a href="#references"><span class="secno"></span> <span class="content">References</span></a>
     <ol class="toc">
      <li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
      <li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a>
     </ol>
    <li><a href="#idl-index"><span class="secno"></span> <span class="content">IDL Index</span></a>
    <li><a href="#issues-index"><span class="secno"></span> <span class="content">Issues Index</span></a>
   </ol>
  </nav>
  <main>
   <h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </span><span class="content">Introduction</span><a class="self-link" href="#intro"></a></h2>
   <p><em>This section is informative.</em></p>
   <p>Web applications should have the ability to manipulate as wide as possible a range of user input,
including files that a user may wish to upload to a remote server or manipulate inside a rich web application.
This specification defines the basic representations for files,
lists of files,
errors raised by access to files,
and programmatic ways to read files.
Additionally, this specification also defines an interface that represents "raw data"
which can be asynchronously processed on the main thread of conforming user agents.
The interfaces and API defined in this specification can be used with other interfaces and APIs exposed to the web platform.</p>
   <p>The <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file③">File</a></code> interface represents file data typically obtained from the underlying file system,
and the <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑤">Blob</a></code> interface
("Binary Large Object" - a name originally introduced to web APIs in <a href="https://developers.google.com/gears/?csw=1">Google Gears</a>)
represents immutable raw data. <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file④">File</a></code> or <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑥">Blob</a></code> reads should happen asynchronously on the main thread,
with an optional synchronous API used within threaded web applications.
An asynchronous API for reading files prevents blocking and UI "freezing" on a user agent’s main thread.
This specification defines an asynchronous API based on an <em>event model</em> to read and access a <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file⑤">File</a></code> or <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑦">Blob</a></code>’s data.
A <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader①">FileReader</a></code> object provides asynchronous read methods to access that file’s data
through event handler content attributes and the firing of events.
The use of events and event handlers allows separate code blocks the ability
to monitor the <em>progress of the read</em> (which is particularly useful for remote drives or mounted drives,
  where file access performance may vary from local drives)
and error conditions that may arise during reading of a file.
An example will be illustrative.</p>
   <div class="example" id="example-db2fd131">
    <a class="self-link" href="#example-db2fd131"></a> In the example below, different code blocks handle progress, error, and success conditions. 
<pre class="highlight"><c- a>function</c-> startRead<c- p>()</c-> <c- p>{</c->
  <c- c1>// obtain input element through DOM</c->

  <c- a>var</c-> file <c- o>=</c-> document<c- p>.</c->getElementById<c- p>(</c-><c- t>'file'</c-><c- p>).</c->files<c- p>[</c-><c- mi>0</c-><c- p>];</c->
  <c- k>if</c-><c- p>(</c->file<c- p>){</c->
    getAsText<c- p>(</c->file<c- p>);</c->
  <c- p>}</c->
<c- p>}</c->

<c- a>function</c-> getAsText<c- p>(</c->readFile<c- p>)</c-> <c- p>{</c->

  <c- a>var</c-> reader <c- o>=</c-> <c- k>new</c-> FileReader<c- p>();</c->

  <c- c1>// Read file into memory as UTF-16</c->
  reader<c- p>.</c->readAsText<c- p>(</c->readFile<c- p>,</c-> <c- u>"UTF-16"</c-><c- p>);</c->

  <c- c1>// Handle progress, success, and errors</c->
  reader<c- p>.</c->onprogress <c- o>=</c-> updateProgress<c- p>;</c->
  reader<c- p>.</c->onload <c- o>=</c-> loaded<c- p>;</c->
  reader<c- p>.</c->onerror <c- o>=</c-> errorHandler<c- p>;</c->
<c- p>}</c->

<c- a>function</c-> updateProgress<c- p>(</c->evt<c- p>)</c-> <c- p>{</c->
  <c- k>if</c-> <c- p>(</c->evt<c- p>.</c->lengthComputable<c- p>)</c-> <c- p>{</c->
    <c- c1>// evt.loaded and evt.total are ProgressEvent properties</c->
    <c- a>var</c-> loaded <c- o>=</c-> <c- p>(</c->evt<c- p>.</c->loaded <c- o>/</c-> evt<c- p>.</c->total<c- p>);</c->
    <c- k>if</c-> <c- p>(</c->loaded <c- o>&lt;</c-> <c- mi>1</c-><c- p>)</c-> <c- p>{</c->
      <c- c1>// Increase the prog bar length</c->
      <c- c1>// style.width = (loaded * 200) + "px";</c->
    <c- p>}</c->
  <c- p>}</c->
<c- p>}</c->

<c- a>function</c-> loaded<c- p>(</c->evt<c- p>)</c-> <c- p>{</c->
  <c- c1>// Obtain the read file data</c->
  <c- a>var</c-> fileString <c- o>=</c-> evt<c- p>.</c->target<c- p>.</c->result<c- p>;</c->
  <c- c1>// Handle UTF-16 file dump</c->
  <c- k>if</c-><c- p>(</c->utils<c- p>.</c->regexp<c- p>.</c->isChinese<c- p>(</c->fileString<c- p>))</c-> <c- p>{</c->
    <c- c1>//Chinese Characters + Name validation</c->
  <c- p>}</c->
  <c- k>else</c-> <c- p>{</c->
    <c- c1>// run other charset test</c->
  <c- p>}</c->
  <c- c1>// xhr.send(fileString)</c->
<c- p>}</c->

<c- a>function</c-> errorHandler<c- p>(</c->evt<c- p>)</c-> <c- p>{</c->
  <c- k>if</c-><c- p>(</c->evt<c- p>.</c->target<c- p>.</c->error<c- p>.</c->name <c- o>==</c-> <c- u>"NotReadableError"</c-><c- p>)</c-> <c- p>{</c->
    <c- c1>// The file could not be read</c->
  <c- p>}</c->
<c- p>}</c->
</pre>
   </div>
   <h2 class="heading settled" data-level="2" id="terminology"><span class="secno">2. </span><span class="content">Terminology and Algorithms</span><a class="self-link" href="#terminology"></a></h2>
   <p>When this specification says to <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="terminate an algorithm|terminate this algorithm" data-noexport id="terminate-an-algorithm">terminate an algorithm</dfn> the user agent must terminate the algorithm after finishing the step it is on.
Asynchronous <a data-link-type="dfn" href="#read-method" id="ref-for-read-method">read methods</a> defined in this specification may return before the algorithm in question is terminated,
and can be terminated by an <code class="idl"><a data-link-type="idl" href="#dfn-abort" id="ref-for-dfn-abort">abort()</a></code> call.</p>
   <p>The algorithms and steps in this specification use the following mathematical operations:</p>
   <ul>
    <li data-md>
     <p>max(a,b) returns the maximum of a and b,
and is always performed on integers as they are defined in WebIDL <a data-link-type="biblio" href="#biblio-webidl">[WebIDL]</a>;
in the case of max(6,4) the result is 6.
This operation is also defined in ECMAScript <a data-link-type="biblio" href="#biblio-ecma-262">[ECMA-262]</a>.</p>
    <li data-md>
     <p>min(a,b) returns the minimum of a and b,
and is always performed on integers as they are defined in WebIDL <a data-link-type="biblio" href="#biblio-webidl">[WebIDL]</a>;
in the case of min(6,4) the result is 4.
This operation is also defined in ECMAScript <a data-link-type="biblio" href="#biblio-ecma-262">[ECMA-262]</a>.</p>
    <li data-md>
     <p>Mathematical comparisons such as &lt; (less than), ≤ (less than or equal to), and > (greater than) are as in ECMAScript <a data-link-type="biblio" href="#biblio-ecma-262">[ECMA-262]</a>.</p>
   </ul>
   <p>The term <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="UnixEpoch">Unix Epoch</dfn> is used in this specification to refer to the time 00:00:00 UTC on January 1 1970
(or 1970-01-01T00:00:00Z ISO 8601);
this is the same time that is conceptually "<code>0</code>" in ECMA-262 <a data-link-type="biblio" href="#biblio-ecma-262">[ECMA-262]</a>.</p>
   <h2 class="heading settled" data-level="3" id="blob-section"><span class="secno">3. </span><span class="content">The Blob Interface and Binary Data</span><a class="self-link" href="#blob-section"></a></h2>
   <p>A <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑧">Blob</a></code> object refers to a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte" id="ref-for-byte">byte</a> sequence,
and has a <code class="idl"><a data-link-type="idl" href="#dfn-size" id="ref-for-dfn-size">size</a></code> attribute which is the total number of bytes in the byte sequence,
and a <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type">type</a></code> attribute,
which is an ASCII-encoded string in lower case representing the media type of the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte" id="ref-for-byte①">byte</a> sequence.</p>
   <p>Each <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑨">Blob</a></code> must have an internal <dfn class="dfn-paneled" data-dfn-for="Blob" data-dfn-type="dfn" data-noexport id="snapshot-state">snapshot state</dfn>,
which must be initially set to the state of the underlying storage,
if any such underlying storage exists.
Further normative definition of <a data-link-type="dfn" href="#snapshot-state" id="ref-for-snapshot-state">snapshot state</a> can be found for <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file⑥">File</a></code>s.</p>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed"><c- g>Exposed</c-></a>=(<c- n>Window</c->,<c- n>Worker</c->), <a class="idl-code" data-link-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#serializable" id="ref-for-serializable"><c- g>Serializable</c-></a>]
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="dfn-Blob"><code><c- g>Blob</c-></code></dfn> {
  <dfn class="dfn-paneled idl-code" data-dfn-for="Blob" data-dfn-type="constructor" data-export data-lt="Blob(blobParts, options)|constructor(blobParts, options)|Blob(blobParts)|constructor(blobParts)|Blob()|constructor()" id="dom-blob-blob"><code><c- g>constructor</c-></code></dfn>(<c- b>optional</c-> <c- b>sequence</c->&lt;<a class="n" data-link-type="idl-name" href="#typedefdef-blobpart" id="ref-for-typedefdef-blobpart"><c- n>BlobPart</c-></a>> <a class="idl-code" data-link-type="argument" href="#dfn-blobParts" id="ref-for-dfn-blobParts"><c- g>blobParts</c-></a>,
              <c- b>optional</c-> <a class="n" data-link-type="idl-name" href="#dfn-BlobPropertyBag" id="ref-for-dfn-BlobPropertyBag"><c- n>BlobPropertyBag</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="Blob/Blob(blobParts, options), Blob/constructor(blobParts, options), Blob/Blob(blobParts), Blob/constructor(blobParts), Blob/Blob(), Blob/constructor()" data-dfn-type="argument" data-export id="dom-blob-blob-blobparts-options-options"><code><c- g>options</c-></code></dfn> = {});

  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-long-long" id="ref-for-idl-unsigned-long-long"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="unsigned long long" href="#dfn-size" id="ref-for-dfn-size①"><c- g>size</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="DOMString" href="#dfn-type" id="ref-for-dfn-type①"><c- g>type</c-></a>;

  // slice Blob into byte-ranged chunks
  <a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob①⓪"><c- n>Blob</c-></a> <a class="idl-code" data-link-type="method" href="#dfn-slice" id="ref-for-dfn-slice"><c- g>slice</c-></a>(<c- b>optional</c-> [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Clamp" id="ref-for-Clamp"><c- g>Clamp</c-></a>] <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-long-long" id="ref-for-idl-long-long"><c- b>long</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="argument" href="#dfn-start" id="ref-for-dfn-start"><c- g>start</c-></a>,
            <c- b>optional</c-> [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Clamp" id="ref-for-Clamp①"><c- g>Clamp</c-></a>] <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-long-long" id="ref-for-idl-long-long①"><c- b>long</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="argument" href="#dfn-end" id="ref-for-dfn-end"><c- g>end</c-></a>,
            <c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString①"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="argument" href="#dfn-contentTypeBlob" id="ref-for-dfn-contentTypeBlob"><c- g>contentType</c-></a>);

  // read from the Blob.
  [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#NewObject" id="ref-for-NewObject"><c- g>NewObject</c-></a>] <a class="n" data-link-type="idl-name" href="https://fetch.spec.whatwg.org/#concept-readablestream" id="ref-for-concept-readablestream"><c- n>ReadableStream</c-></a> <a class="idl-code" data-link-type="method" href="#dom-blob-stream" id="ref-for-dom-blob-stream"><c- g>stream</c-></a>();
  [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#NewObject" id="ref-for-NewObject①"><c- g>NewObject</c-></a>] <c- b>Promise</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString"><c- b>USVString</c-></a>> <a class="idl-code" data-link-type="method" href="#dom-blob-text" id="ref-for-dom-blob-text"><c- g>text</c-></a>();
  [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#NewObject" id="ref-for-NewObject②"><c- g>NewObject</c-></a>] <c- b>Promise</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer"><c- b>ArrayBuffer</c-></a>> <a class="idl-code" data-link-type="method" href="#dom-blob-arraybuffer" id="ref-for-dom-blob-arraybuffer"><c- g>arrayBuffer</c-></a>();
};

<c- b>enum</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="enum" data-export id="enumdef-endingtype"><code><c- g>EndingType</c-></code></dfn> { <dfn class="dfn-paneled idl-code" data-dfn-for="EndingType" data-dfn-type="enum-value" data-export id="dom-endingtype-transparent"><code><c- s>"transparent"</c-></code></dfn>, <dfn class="dfn-paneled idl-code" data-dfn-for="EndingType" data-dfn-type="enum-value" data-export id="dom-endingtype-native"><code><c- s>"native"</c-></code></dfn> };

<c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dfn-BlobPropertyBag"><code><c- g>BlobPropertyBag</c-></code></dfn> {
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString②"><c- b>DOMString</c-></a> <a class="idl-code" data-default="&quot;&quot;" data-link-type="dict-member" data-type="DOMString " href="#dfn-BPtype" id="ref-for-dfn-BPtype"><c- g>type</c-></a> = "";
  <a class="n" data-link-type="idl-name" href="#enumdef-endingtype" id="ref-for-enumdef-endingtype"><c- n>EndingType</c-></a> <a class="idl-code" data-default="&quot;transparent&quot;" data-link-type="dict-member" data-type="EndingType " href="#dom-blobpropertybag-endings" id="ref-for-dom-blobpropertybag-endings"><c- g>endings</c-></a> = "transparent";
};

<c- b>typedef</c-> (<a class="n" data-link-type="idl-name" href="https://heycam.github.io/webidl/#BufferSource" id="ref-for-BufferSource"><c- n>BufferSource</c-></a> <c- b>or</c-> <a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob①①"><c- n>Blob</c-></a> <c- b>or</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①"><c- b>USVString</c-></a>) <dfn class="dfn-paneled idl-code" data-dfn-type="typedef" data-export id="typedefdef-blobpart"><code><c- g>BlobPart</c-></code></dfn>;
</pre>
   <p><code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob①②">Blob</a></code> objects are <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#serializable-objects" id="ref-for-serializable-objects">serializable objects</a>. Their <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#serialization-steps" id="ref-for-serialization-steps">serialization steps</a>,
given <var>value</var> and <var>serialized</var>, are:</p>
   <ol>
    <li data-md>
     <p>Set <var>serialized</var>.[[SnapshotState]] to <var>value</var>’s <a data-link-type="dfn" href="#snapshot-state" id="ref-for-snapshot-state①">snapshot state</a>.</p>
    <li data-md>
     <p>Set <var>serialized</var>.[[ByteSequence]] to <var>value</var>’s underlying byte sequence.</p>
   </ol>
   <p>Their <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#deserialization-steps" id="ref-for-deserialization-steps">deserialization step</a>, given <var>serialized</var> and <var>value</var>, are:</p>
   <ol>
    <li data-md>
     <p>Set <var>value</var>’s <a data-link-type="dfn" href="#snapshot-state" id="ref-for-snapshot-state②">snapshot state</a> to <var>serialized</var>.[[SnapshotState]].</p>
    <li data-md>
     <p>Set <var>value</var>’s underlying byte sequence to <var>serialized</var>.[[ByteSequence]].</p>
   </ol>
   <div class="algorithm" data-algorithm="get stream">
     A <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob①③">Blob</a></code> <var>blob</var> has an associated <dfn class="dfn-paneled" data-dfn-for="Blob" data-dfn-type="dfn" data-noexport id="blob-get-stream">get stream</dfn> algorithm,
which runs these steps: 
    <ol>
     <li data-md>
      <p>Let <var>stream</var> be the result of <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-construct-readablestream" id="ref-for-concept-construct-readablestream">constructing</a> a <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-readablestream" id="ref-for-concept-readablestream①">ReadableStream</a></code> object.</p>
     <li data-md>
      <p>Run the following steps <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel" id="ref-for-in-parallel">in parallel</a>:</p>
      <ol>
       <li data-md>
        <p>While not all bytes of <var>blob</var> have been read:</p>
        <ol>
         <li data-md>
          <p>Let <var>bytes</var> be the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence" id="ref-for-byte-sequence">byte sequence</a> that results from reading a <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#chunk" id="ref-for-chunk">chunk</a> from <var>blob</var>.</p>
         <li data-md>
          <p>If a <a data-link-type="dfn" href="#file-error-read" id="ref-for-file-error-read">file read error</a> occured while reading <var>bytes</var>, <a data-link-type="abstract-op" href="https://fetch.spec.whatwg.org/#concept-error-readablestream" id="ref-for-concept-error-readablestream">error</a> <var>stream</var> with a <a data-link-type="dfn" href="#failureReason" id="ref-for-failureReason">failure reason</a> and abort these steps.</p>
         <li data-md>
          <p><a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-enqueue-readablestream" id="ref-for-concept-enqueue-readablestream">Enqueue</a> a <code>Uint8Array</code> object wrapping an <code>ArrayBuffer</code> containing <var>bytes</var> into <var>stream</var>.
 If that threw an exception, <a data-link-type="abstract-op" href="https://fetch.spec.whatwg.org/#concept-error-readablestream" id="ref-for-concept-error-readablestream①">error</a> <var>stream</var> with that exception
 and abort these steps.</p>
        </ol>
        <p class="issue" id="issue-27e70e89"><a class="self-link" href="#issue-27e70e89"></a> We need to specify more concretely what reading from a Blob actually does,
what possible errors can happen, perhaps something about chunk sizes, etc.</p>
      </ol>
     <li data-md>
      <p>Return <var>stream</var>.</p>
    </ol>
   </div>
   <h3 class="heading settled" data-level="3.1" id="constructorBlob"><span class="secno">3.1. </span><span class="content">Constructors</span><a class="self-link" href="#constructorBlob"></a></h3>
   <div class="algorithm" data-algorithm="blob-constructor">
     The <code class="idl"><a data-link-type="idl" href="#dom-blob-blob" id="ref-for-dom-blob-blob">Blob()</a></code> constructor can be invoked with zero or more parameters.
When the <code class="idl"><a data-link-type="idl" href="#dom-blob-blob" id="ref-for-dom-blob-blob①">Blob()</a></code> constructor is invoked,
user agents must run the following steps: 
    <ol>
     <li data-md>
      <p>If invoked with zero parameters,
return a new <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob①④">Blob</a></code> object consisting of 0 bytes,
with <code class="idl"><a data-link-type="idl" href="#dfn-size" id="ref-for-dfn-size②">size</a></code> set to 0,
and with <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type②">type</a></code> set to the empty string.</p>
     <li data-md>
      <p>Let <var>bytes</var> be the result of <a data-link-type="dfn" href="#process-blob-parts" id="ref-for-process-blob-parts">processing blob parts</a> given <code class="idl"><a data-link-type="idl" href="#dfn-blobParts" id="ref-for-dfn-blobParts①">blobParts</a></code> and <code class="idl"><a data-link-type="idl" href="#dom-blob-blob-blobparts-options-options" id="ref-for-dom-blob-blob-blobparts-options-options">options</a></code>.</p>
     <li data-md>
      <p>If the <code class="idl"><a data-link-type="idl" href="#dfn-BPtype" id="ref-for-dfn-BPtype①">type</a></code> member of the <code class="idl"><a data-link-type="idl" href="#dom-blob-blob-blobparts-options-options" id="ref-for-dom-blob-blob-blobparts-options-options①">options</a></code> argument is not the empty string,
run the following sub-steps:</p>
      <ol>
       <li data-md>
        <p>Let <var>t</var> be the <code class="idl"><a data-link-type="idl" href="#dfn-BPtype" id="ref-for-dfn-BPtype②">type</a></code> dictionary member.
If <var>t</var> contains any characters outside the range U+0020 to U+007E,
then set <var>t</var> to the empty string and return from these substeps.</p>
       <li data-md>
        <p>Convert every character in <var>t</var> to <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-lowercase" id="ref-for-ascii-lowercase">ASCII lowercase</a>.</p>
      </ol>
     <li data-md>
      <p>Return a <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob①⑤">Blob</a></code> object referring to <var>bytes</var> as its associated <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte" id="ref-for-byte②">byte</a> sequence,
with its <code class="idl"><a data-link-type="idl" href="#dfn-size" id="ref-for-dfn-size③">size</a></code> set to the length of <var>bytes</var>,
and its <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type③">type</a></code> set to the value of <var>t</var> from the substeps above.</p>
    </ol>
   </div>
   <h4 class="heading settled" data-level="3.1.1" id="constructorParams"><span class="secno">3.1.1. </span><span class="content">Constructor Parameters</span><a class="self-link" href="#constructorParams"></a></h4>
   <p>The <code class="idl"><a data-link-type="idl" href="#dom-blob-blob" id="ref-for-dom-blob-blob②">Blob()</a></code> constructor can be invoked with the parameters below:</p>
   <dl>
    <dt>A <dfn class="dfn-paneled idl-code" data-dfn-for="Blob/Blob(blobParts, options)" data-dfn-type="argument" data-export id="dfn-blobParts"><code>blobParts</code></dfn> <code>sequence</code> 
    <dd>
     which takes any number of the following types of elements, and in any order: 
     <ul>
      <li data-md>
       <p><code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#BufferSource" id="ref-for-BufferSource①">BufferSource</a></code> elements.</p>
      <li data-md>
       <p><code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob①⑥">Blob</a></code> elements.</p>
      <li data-md>
       <p><code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②">USVString</a></code> elements.</p>
     </ul>
    <dt id="dfn-BlobPropertyBagMembers"><a class="self-link" href="#dfn-BlobPropertyBagMembers"></a>An <em>optional</em> <code class="idl"><a data-link-type="idl" href="#dfn-BlobPropertyBag" id="ref-for-dfn-BlobPropertyBag①">BlobPropertyBag</a></code> 
    <dd>
     which takes these optional members: 
     <ul>
      <li data-md>
       <p><dfn class="dfn-paneled idl-code" data-dfn-for="BlobPropertyBag" data-dfn-type="dict-member" data-export id="dfn-BPtype"><code>type</code></dfn>,
the ASCII-encoded string in lower case representing the media type of the <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob①⑦">Blob</a></code>.
Normative conditions for this member are provided in the <a href="#constructorBlob">§ 3.1 Constructors</a>.</p>
      <li data-md>
       <p><dfn class="dfn-paneled idl-code" data-dfn-for="BlobPropertyBag" data-dfn-type="dict-member" data-export id="dom-blobpropertybag-endings"><code>endings</code></dfn>,
an enum which can take the values <code class="idl"><a data-link-type="idl" href="#dom-endingtype-transparent" id="ref-for-dom-endingtype-transparent">"transparent"</a></code> or <code class="idl"><a data-link-type="idl" href="#dom-endingtype-native" id="ref-for-dom-endingtype-native">"native"</a></code>.
By default this is set to <code class="idl"><a data-link-type="idl" href="#dom-endingtype-transparent" id="ref-for-dom-endingtype-transparent①">"transparent"</a></code>. If set to <code class="idl"><a data-link-type="idl" href="#dom-endingtype-native" id="ref-for-dom-endingtype-native①">"native"</a></code>, <a data-link-type="dfn" href="#convert-line-endings-to-native" id="ref-for-convert-line-endings-to-native">line endings will be converted to native</a> in any <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString③">USVString</a></code> elements in <code class="idl"><a data-link-type="idl" href="#dfn-blobParts" id="ref-for-dfn-blobParts②">blobParts</a></code>.</p>
     </ul>
   </dl>
   <div class="algorithm" data-algorithm="process-blob-parts">
     To <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="process blob parts|processing blob parts" data-noexport id="process-blob-parts">process blob parts</dfn> given a sequence of <code class="idl"><a data-link-type="idl" href="#typedefdef-blobpart" id="ref-for-typedefdef-blobpart①">BlobPart</a></code>'s <var>parts</var> and <code class="idl"><a data-link-type="idl" href="#dfn-BlobPropertyBag" id="ref-for-dfn-BlobPropertyBag②">BlobPropertyBag</a></code> <var>options</var>,
run the following steps: 
    <ol>
     <li data-md>
      <p>Let <var>bytes</var> be an empty sequence of bytes.</p>
     <li data-md>
      <p>For each <var>element</var> in <var>parts</var>:</p>
      <ol>
       <li data-md>
        <p>If <var>element</var> is a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString④">USVString</a></code>, run the following substeps:</p>
        <ol>
         <li data-md>
          <p>Let <var>s</var> be <var>element</var>.</p>
         <li data-md>
          <p>If the <code class="idl"><a data-link-type="idl" href="#dom-blobpropertybag-endings" id="ref-for-dom-blobpropertybag-endings①">endings</a></code> member of <var>options</var> is <code class="idl"><a data-link-type="idl" href="#dom-endingtype-native" id="ref-for-dom-endingtype-native②">"native"</a></code>,
set <var>s</var> to the result of <a data-link-type="dfn" href="#convert-line-endings-to-native" id="ref-for-convert-line-endings-to-native①">converting line endings to native</a> of <var>element</var>.</p>
         <li data-md>
          <p>Append the result of <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-encode" id="ref-for-utf-8-encode">UTF-8 encoding</a> <var>s</var> to <var>bytes</var>.</p>
          <p class="note" role="note"><span>Note:</span> The algorithm from WebIDL <a data-link-type="biblio" href="#biblio-webidl">[WebIDL]</a> replaces unmatched surrogates in an invalid utf-16 string
with U+FFFD replacement characters.
Scenarios exist when the <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob①⑧">Blob</a></code> constructor may result in some data loss
due to lost or scrambled character sequences.</p>
        </ol>
       <li data-md>
        <p>If <var>element</var> is a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#BufferSource" id="ref-for-BufferSource②">BufferSource</a></code>, <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-get-buffer-source-copy" id="ref-for-dfn-get-buffer-source-copy">get
a copy of the bytes held by the buffer source</a>, and append those bytes to <var>bytes</var>.</p>
       <li data-md>
        <p>If <var>element</var> is a <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob①⑨">Blob</a></code>,
append the bytes it represents to <var>bytes</var>.</p>
        <p class="note" role="note"><span>Note:</span> The <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type④">type</a></code> of the <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob②⓪">Blob</a></code> array element is ignored and will not affect <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type⑤">type</a></code> of returned <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob②①">Blob</a></code> object.</p>
      </ol>
     <li data-md>
      <p>Return <var>bytes</var>.</p>
    </ol>
   </div>
   <div class="algorithm" data-algorithm="convert-line-endings-to-native">
     To <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="convert line endings to native|converting line endings to native" data-noexport id="convert-line-endings-to-native"> convert line endings to native</dfn> in a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#string" id="ref-for-string">string</a> <var>s</var>,
run the following steps: 
    <ol>
     <li data-md>
      <p>Let <var>native line ending</var> be be the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point">code point</a> U+000A LF.</p>
     <li data-md>
      <p>If the underlying platform’s conventions are
to represent newlines as a carriage return and line feed sequence,
set <var>native line ending</var> to the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point①">code point</a> U+000D CR
followed by the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point②">code point</a> U+000A LF.</p>
     <li data-md>
      <p>Set <var>result</var> to the empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#string" id="ref-for-string①">string</a>.</p>
     <li data-md>
      <p>Let <var>position</var> be a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#string-position-variable" id="ref-for-string-position-variable">position variable</a> for <var>s</var>,
initially pointing at the start of <var>s</var>.</p>
     <li data-md>
      <p>Let <var>token</var> be the result of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points" id="ref-for-collect-a-sequence-of-code-points">collecting a sequence of code points</a> that are not equal to U+000A LF or U+000D CR
from <var>s</var> given <var>position</var>.</p>
     <li data-md>
      <p>Append <var>token</var> to <var>result</var>.</p>
     <li data-md>
      <p>While <var>position</var> is not past the end of <var>s</var>:</p>
      <ol>
       <li data-md>
        <p>If the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point③">code point</a> at <var>position</var> within <var>s</var> equals U+000D CR:</p>
        <ol>
         <li data-md>
          <p>Append <var>native line ending</var> to <var>result</var>.</p>
         <li data-md>
          <p>Advance <var>position</var> by 1.</p>
         <li data-md>
          <p>If <var>position</var> is not past the end of <var>s</var> and the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point④">code point</a> at <var>position</var> within <var>s</var> equals U+000A LF
advance <var>position</var> by 1.</p>
        </ol>
       <li data-md>
        <p>Otherwise if the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑤">code point</a> at <var>position</var> within <var>s</var> equals U+000A LF,
advance <var>position</var> by 1 and append <var>native line ending</var> to <var>result</var>.</p>
       <li data-md>
        <p>Let <var>token</var> be the result of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points" id="ref-for-collect-a-sequence-of-code-points①">collecting a sequence of code points</a> that are not equal to U+000A LF or U+000D CR
from <var>s</var> given <var>position</var>.</p>
       <li data-md>
        <p>Append <var>token</var> to <var>result</var>.</p>
      </ol>
     <li data-md>
      <p>Return <var>result</var>.</p>
    </ol>
   </div>
   <div class="example" id="example-74beb70c">
    <a class="self-link" href="#example-74beb70c"></a> Examples of constructor usage follow. 
<pre class="lang-javascript highlight"><c- c1>// Create a new Blob object</c->

<c- a>var</c-> a <c- o>=</c-> <c- k>new</c-> Blob<c- p>();</c->

<c- c1>// Create a 1024-byte ArrayBuffer</c->
<c- c1>// buffer could also come from reading a File</c->

<c- a>var</c-> buffer <c- o>=</c-> <c- k>new</c-> ArrayBuffer<c- p>(</c-><c- mi>1024</c-><c- p>);</c->

<c- c1>// Create ArrayBufferView objects based on buffer</c->

<c- a>var</c-> shorts <c- o>=</c-> <c- k>new</c-> Uint16Array<c- p>(</c->buffer<c- p>,</c-> <c- mi>512</c-><c- p>,</c-> <c- mi>128</c-><c- p>);</c->
<c- a>var</c-> bytes <c- o>=</c-> <c- k>new</c-> Uint8Array<c- p>(</c->buffer<c- p>,</c-> shorts<c- p>.</c->byteOffset <c- o>+</c-> shorts<c- p>.</c->byteLength<c- p>);</c->

<c- a>var</c-> b <c- o>=</c-> <c- k>new</c-> Blob<c- p>([</c-><c- u>"foobarbazetcetc"</c-> <c- o>+</c-> <c- u>"birdiebirdieboo"</c-><c- p>],</c-> <c- p>{</c->type<c- o>:</c-> <c- u>"text/plain;charset=utf-8"</c-><c- p>});</c->

<c- a>var</c-> c <c- o>=</c-> <c- k>new</c-> Blob<c- p>([</c->b<c- p>,</c-> shorts<c- p>]);</c->

<c- a>var</c-> a <c- o>=</c-> <c- k>new</c-> Blob<c- p>([</c->b<c- p>,</c-> c<c- p>,</c-> bytes<c- p>]);</c->

<c- a>var</c-> d <c- o>=</c-> <c- k>new</c-> Blob<c- p>([</c->buffer<c- p>,</c-> b<c- p>,</c-> c<c- p>,</c-> bytes<c- p>]);</c->
</pre>
   </div>
   <h3 class="heading settled" data-level="3.2" id="attributes-blob"><span class="secno">3.2. </span><span class="content">Attributes</span><a class="self-link" href="#attributes-blob"></a></h3>
   <dl>
    <dt><dfn class="dfn-paneled idl-code" data-dfn-for="Blob" data-dfn-type="attribute" data-export id="dfn-size"><code>size</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://heycam.github.io/webidl/#idl-unsigned-long-long" id="ref-for-idl-unsigned-long-long①">unsigned long long</a>, readonly</span>
    <dd>Returns the size of the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte" id="ref-for-byte③">byte</a> sequence in number of bytes.
    On getting, conforming user agents must return the total number of bytes that can be read by a <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader②">FileReader</a></code> or <code class="idl"><a data-link-type="idl" href="#dfn-FileReaderSync" id="ref-for-dfn-FileReaderSync">FileReaderSync</a></code> object,
    or 0 if the <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob②②">Blob</a></code> has no bytes to be read. 
    <dt><dfn class="dfn-paneled idl-code" data-dfn-for="Blob" data-dfn-type="attribute" data-export id="dfn-type"><code>type</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString③">DOMString</a>, readonly</span>
    <dd>
     The ASCII-encoded string in lower case representing the media type of the <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob②③">Blob</a></code>.
    On getting, user agents must return the type of a <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob②④">Blob</a></code> as an ASCII-encoded string in lower case,
    such that when it is converted to a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte" id="ref-for-byte④">byte</a> sequence,
    it is a <a data-link-type="dfn" href="https://mimesniff.spec.whatwg.org/#parsable-mime-type" id="ref-for-parsable-mime-type">parsable MIME type</a>,
    or the empty string – 0 bytes – if the type cannot be determined. 
     <p>The <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type⑥">type</a></code> attribute can be set by the web application itself through constructor invocation
    and through the <code class="idl"><a data-link-type="idl" href="#dfn-slice" id="ref-for-dfn-slice①">slice()</a></code> call;
    in these cases, further normative conditions for this attribute are in <a href="#constructorBlob">§ 3.1 Constructors</a>, <a href="#file-constructor">§ 4.1 Constructor</a>,
    and <a href="#slice-method-algo">§ 3.3.1 The slice() method</a> respectively.
    User agents can also determine the <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type⑦">type</a></code> of a <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob②⑤">Blob</a></code>,
    especially if the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte" id="ref-for-byte⑤">byte</a> sequence is from an on-disk file;
    in this case, further normative conditions are in the <a data-link-type="dfn" href="#file-type-guidelines" id="ref-for-file-type-guidelines">file type guidelines</a>.</p>
     <p class="note" role="note"><span>Note:</span> The type <var>t</var> of a <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob②⑥">Blob</a></code> is considered a <a data-link-type="dfn" href="https://mimesniff.spec.whatwg.org/#parsable-mime-type" id="ref-for-parsable-mime-type①">parsable MIME type</a>,
    if performing the <a data-link-type="dfn" href="https://mimesniff.spec.whatwg.org/#parse-a-mime-type" id="ref-for-parse-a-mime-type">parse a MIME type</a> algorithm to a byte sequence converted from
    the ASCII-encoded string representing the Blob object’s type does not return failure.</p>
     <p class="note" role="note"><span>Note:</span> Use of the <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type⑧">type</a></code> attribute informs the <a data-link-type="dfn" href="#blob-package-data" id="ref-for-blob-package-data">package data</a> algorithm
    and determines the <code>Content-Type</code> header when <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-fetch" id="ref-for-concept-fetch">fetching</a> <a data-link-type="dfn" href="#blob-url" id="ref-for-blob-url">blob URLs</a>.</p>
   </dl>
   <h3 class="heading settled" data-level="3.3" id="methodsandparams-blob"><span class="secno">3.3. </span><span class="content">Methods and Parameters</span><a class="self-link" href="#methodsandparams-blob"></a></h3>
   <h4 class="heading settled" data-level="3.3.1" id="slice-method-algo"><span class="secno">3.3.1. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#dfn-slice" id="ref-for-dfn-slice②">slice()</a></code> method</span><a class="self-link" href="#slice-method-algo"></a></h4>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="Blob" data-dfn-type="method" data-export data-lt="slice(start, end, contentType)|slice(start, end)|slice(start)|slice()|slice(start, end, contentType), slice(start, end), slice(start), slice()" id="dfn-slice"><code>slice()</code></dfn> method
returns a new <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob②⑦">Blob</a></code> object with bytes ranging from
the optional <code class="idl"><a data-link-type="idl" href="#dfn-start" id="ref-for-dfn-start①">start</a></code> parameter
up to but not including the optional <code class="idl"><a data-link-type="idl" href="#dfn-end" id="ref-for-dfn-end①">end</a></code> parameter,
and with a <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type⑨">type</a></code> attribute that is the value of the optional <code class="idl"><a class="idl-code" data-link-type="argument" href="#dfn-contentTypeBlob" id="ref-for-dfn-contentTypeBlob①">contentType</a></code> parameter.
It must act as follows:</p>
   <ol>
    <li data-md>
     <p>Let <var>O</var> be the <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob②⑧">Blob</a></code> <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object">context object</a> on which the <code class="idl"><a data-link-type="idl" href="#dfn-slice" id="ref-for-dfn-slice③">slice()</a></code> method is being called.</p>
    <li data-md>
     <p>The optional <dfn class="dfn-paneled idl-code" data-dfn-for="Blob/slice(start, end, contentType)" data-dfn-type="argument" data-export id="dfn-start"><code>start</code></dfn> parameter
is a value for the start point of a <code class="idl"><a data-link-type="idl" href="#dfn-slice" id="ref-for-dfn-slice④">slice()</a></code> call,
and must be treated as a byte-order position,
with the zeroth position representing the first byte.
User agents must process <code class="idl"><a data-link-type="idl" href="#dfn-slice" id="ref-for-dfn-slice⑤">slice()</a></code> with <code class="idl"><a data-link-type="idl" href="#dfn-start" id="ref-for-dfn-start②">start</a></code> normalized according to the following:</p>
     <ol type="a">
      <li>If the optional <code class="idl"><a data-link-type="idl" href="#dfn-start" id="ref-for-dfn-start③">start</a></code> parameter is not used as a parameter when making this call, let <var>relativeStart</var> be 0. 
      <li>If <code class="idl"><a data-link-type="idl" href="#dfn-start" id="ref-for-dfn-start④">start</a></code> is negative, let <var>relativeStart</var> be <code>max((<code class="idl"><a data-link-type="idl" href="#dfn-size" id="ref-for-dfn-size④">size</a></code> + <code class="idl"><a data-link-type="idl" href="#dfn-start" id="ref-for-dfn-start⑤">start</a></code>), 0)</code>. 
      <li>Else, let <var>relativeStart</var> be <code>min(start, size)</code>. 
     </ol>
    <li data-md>
     <p>The optional <dfn class="dfn-paneled idl-code" data-dfn-for="Blob/slice(start, end, contentType)" data-dfn-type="argument" data-export id="dfn-end"><code>end</code></dfn> parameter
is a value for the end point of a <code class="idl"><a data-link-type="idl" href="#dfn-slice" id="ref-for-dfn-slice⑥">slice()</a></code> call.
User agents must process <code class="idl"><a data-link-type="idl" href="#dfn-slice" id="ref-for-dfn-slice⑦">slice()</a></code> with <code class="idl"><a data-link-type="idl" href="#dfn-end" id="ref-for-dfn-end②">end</a></code> normalized according to the following:</p>
     <ol type="a">
      <li>If the optional <code class="idl"><a data-link-type="idl" href="#dfn-end" id="ref-for-dfn-end③">end</a></code> parameter is not used as a parameter when making this call, let <var>relativeEnd</var> be <code class="idl"><a data-link-type="idl" href="#dfn-size" id="ref-for-dfn-size⑤">size</a></code>. 
      <li>If <code class="idl"><a data-link-type="idl" href="#dfn-end" id="ref-for-dfn-end④">end</a></code> is negative, let <var>relativeEnd</var> be <code>max((size + end), 0)</code>. 
      <li>Else, let <var>relativeEnd</var> be <code>min(end, size)</code>. 
     </ol>
    <li data-md>
     <p>The optional <dfn class="dfn-paneled idl-code" data-dfn-for="Blob/slice(start, end, contentType)" data-dfn-type="argument" data-export id="dfn-contentTypeBlob"><code>contentType</code></dfn> parameter
is used to set the ASCII-encoded string in lower case representing the media type of the Blob.
User agents must process the <code class="idl"><a data-link-type="idl" href="#dfn-slice" id="ref-for-dfn-slice⑧">slice()</a></code> with <code class="idl"><a data-link-type="idl" href="#dfn-contentTypeBlob" id="ref-for-dfn-contentTypeBlob②">contentType</a></code> normalized according to the following:</p>
     <ol type="a">
      <li>If the <code class="idl"><a data-link-type="idl" href="#dfn-contentTypeBlob" id="ref-for-dfn-contentTypeBlob③">contentType</a></code> parameter is not provided, let <var>relativeContentType</var> be set to the empty string. 
      <li>
       Else let <var>relativeContentType</var> be set to <code class="idl"><a data-link-type="idl" href="#dfn-contentTypeBlob" id="ref-for-dfn-contentTypeBlob④">contentType</a></code> and run the substeps below: 
       <ol>
        <li data-md>
         <p>If <var>relativeContentType</var> contains any characters outside the range of U+0020 to U+007E,
then set <var>relativeContentType</var> to the empty string and return from these substeps.</p>
        <li data-md>
         <p>Convert every character in <var>relativeContentType</var> to <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-lowercase" id="ref-for-ascii-lowercase①">ASCII lowercase</a>.</p>
       </ol>
     </ol>
    <li data-md>
     <p>Let <var>span</var> be <code>max((relativeEnd - relativeStart), 0)</code>.</p>
    <li data-md>
     <p>Return a new <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob②⑨">Blob</a></code> object <var>S</var> with the following characteristics:</p>
     <ol type="a">
      <li><var>S</var> refers to <var>span</var> consecutive <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte" id="ref-for-byte⑥">byte</a>s from <var>O</var>,
    beginning with the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte" id="ref-for-byte⑦">byte</a> at byte-order position <var>relativeStart</var>. 
      <li><var>S</var>.<code class="idl"><a data-link-type="idl" href="#dfn-size" id="ref-for-dfn-size⑥">size</a></code> = <var>span</var>. 
      <li><var>S</var>.<code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type①⓪">type</a></code> = <var>relativeContentType</var>. 
     </ol>
   </ol>
   <div class="example" id="example-0ffe45c5">
    <a class="self-link" href="#example-0ffe45c5"></a> The examples below illustrate the different types of <code class="idl"><a data-link-type="idl" href="#dfn-slice" id="ref-for-dfn-slice⑨">slice()</a></code> calls possible. Since the <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file⑦">File</a></code> interface inherits from the <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob③⓪">Blob</a></code> interface, examples are based on the use of the <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file⑧">File</a></code> interface. 
<pre class="lang-javascript highlight"><c- c1>// obtain input element through DOM</c->

<c- a>var</c-> file <c- o>=</c-> document<c- p>.</c->getElementById<c- p>(</c-><c- t>'file'</c-><c- p>).</c->files<c- p>[</c-><c- mi>0</c-><c- p>];</c->
<c- k>if</c-><c- p>(</c->file<c- p>)</c->
<c- p>{</c->
  <c- c1>// create an identical copy of file</c->
  <c- c1>// the two calls below are equivalent</c->

  <c- a>var</c-> fileClone <c- o>=</c-> file<c- p>.</c->slice<c- p>();</c->
  <c- a>var</c-> fileClone2 <c- o>=</c-> file<c- p>.</c->slice<c- p>(</c-><c- mi>0</c-><c- p>,</c-> file<c- p>.</c->size<c- p>);</c->

  <c- c1>// slice file into 1/2 chunk starting at middle of file</c->
  <c- c1>// Note the use of negative number</c->

  <c- a>var</c-> fileChunkFromEnd <c- o>=</c-> file<c- p>.</c->slice<c- p>(</c-><c- o>-</c-><c- p>(</c->Math<c- p>.</c->round<c- p>(</c->file<c- p>.</c->size<c- o>/</c-><c- mi>2</c-><c- p>)));</c->

  <c- c1>// slice file into 1/2 chunk starting at beginning of file</c->

  <c- a>var</c-> fileChunkFromStart <c- o>=</c-> file<c- p>.</c->slice<c- p>(</c-><c- mi>0</c-><c- p>,</c-> Math<c- p>.</c->round<c- p>(</c->file<c- p>.</c->size<c- o>/</c-><c- mi>2</c-><c- p>));</c->

  <c- c1>// slice file from beginning till 150 bytes before end</c->

  <c- a>var</c-> fileNoMetadata <c- o>=</c-> file<c- p>.</c->slice<c- p>(</c-><c- mi>0</c-><c- p>,</c-> <c- o>-</c-><c- mi>150</c-><c- p>,</c-> <c- u>"application/experimental"</c-><c- p>);</c->
<c- p>}</c->
</pre>
   </div>
   <h4 class="heading settled" data-level="3.3.2" id="stream-method-algo"><span class="secno">3.3.2. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#dom-blob-stream" id="ref-for-dom-blob-stream①">stream()</a></code> method</span><a class="self-link" href="#stream-method-algo"></a></h4>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="Blob" data-dfn-type="method" data-export id="dom-blob-stream"><code>stream()</code></dfn> method, when invoked, must return
the result of calling <a data-link-type="dfn" href="#blob-get-stream" id="ref-for-blob-get-stream">get stream</a> on the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①">context object</a>.</p>
   <h4 class="heading settled" data-level="3.3.3" id="text-method-algo"><span class="secno">3.3.3. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#dom-blob-text" id="ref-for-dom-blob-text①">text()</a></code> method</span><a class="self-link" href="#text-method-algo"></a></h4>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="Blob" data-dfn-type="method" data-export id="dom-blob-text"><code>text()</code></dfn> method, when invoked, must run these steps:</p>
   <ol>
    <li data-md>
     <p>Let <var>stream</var> be the result of calling <a data-link-type="dfn" href="#blob-get-stream" id="ref-for-blob-get-stream①">get stream</a> on the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object②">context object</a>.</p>
    <li data-md>
     <p>Let <var>reader</var> be the result of <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-get-reader" id="ref-for-concept-get-reader">getting a reader</a> from <var>stream</var>.
 If that threw an exception, return a new promise rejected with that exception.</p>
    <li data-md>
     <p>Let <var>promise</var> be the result of <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-read-all-bytes-from-readablestream" id="ref-for-concept-read-all-bytes-from-readablestream">reading all bytes</a> from <var>stream</var> with <var>reader</var>.</p>
    <li data-md>
     <p>Return the result of transforming <var>promise</var> by a fulfillment handler that returns the result of
 running <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-decode" id="ref-for-utf-8-decode">UTF-8 decode</a> on its first argument.</p>
   </ol>
   <p class="note" role="note"><span>Note:</span> This is different from the behavior of <code class="idl"><a data-link-type="idl" href="#dfn-readAsText" id="ref-for-dfn-readAsText">readAsText()</a></code> to align better
with the behavior of <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#dom-body-text" id="ref-for-dom-body-text">Fetch’s text()</a></code>. Specifically this method will always
use UTF-8 as encoding, while <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader③">FileReader</a></code> can use a different encoding depending on
the blob’s type and passed in encoding name.</p>
   <h4 class="heading settled" data-level="3.3.4" id="arraybuffer-method-algo"><span class="secno">3.3.4. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#dom-blob-arraybuffer" id="ref-for-dom-blob-arraybuffer①">arrayBuffer()</a></code> method</span><a class="self-link" href="#arraybuffer-method-algo"></a></h4>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="Blob" data-dfn-type="method" data-export id="dom-blob-arraybuffer"><code>arrayBuffer()</code></dfn> method, when invoked, must run these steps:</p>
   <ol>
    <li data-md>
     <p>Let <var>stream</var> be the result of calling <a data-link-type="dfn" href="#blob-get-stream" id="ref-for-blob-get-stream②">get stream</a> on the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object③">context object</a>.</p>
    <li data-md>
     <p>Let <var>reader</var> be the result of <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-get-reader" id="ref-for-concept-get-reader①">getting a reader</a> from <var>stream</var>.
 If that threw an exception, return a new promise rejected with that exception.</p>
    <li data-md>
     <p>Let <var>promise</var> be the result of <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-read-all-bytes-from-readablestream" id="ref-for-concept-read-all-bytes-from-readablestream①">reading all bytes</a> from <var>stream</var> with <var>reader</var>.</p>
    <li data-md>
     <p>Return the result of transforming <var>promise</var> by a fulfillment handler that returns
 a new <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer①">ArrayBuffer</a></code> whose contents are its first argument.</p>
   </ol>
   <h2 class="heading settled" data-level="4" id="file-section"><span class="secno">4. </span><span class="content">The File Interface</span><a class="self-link" href="#file-section"></a></h2>
   <p>A <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file⑨">File</a></code> object is a <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob③①">Blob</a></code> object with a <code class="idl"><a data-link-type="idl" href="#dfn-name" id="ref-for-dfn-name">name</a></code> attribute, which is a string;
it can be created within the web application via a constructor,
or is a reference to a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte" id="ref-for-byte⑧">byte</a> sequence from a file from the underlying (OS) file system.</p>
   <p>If a <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file①⓪">File</a></code> object is a reference to a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte" id="ref-for-byte⑨">byte</a> sequence originating from a file on disk,
then its <a data-link-type="dfn" href="#snapshot-state" id="ref-for-snapshot-state③">snapshot state</a> should be set to the state of the file on disk at the time the <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file①①">File</a></code> object is created.</p>
   <p class="note" role="note"><span>Note:</span> This is a non-trivial requirement to implement for user agents,
and is thus not a <em>must</em> but a <em>should</em> <a data-link-type="biblio" href="#biblio-rfc2119">[RFC2119]</a>.
User agents should endeavor to have a <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file①②">File</a></code> object’s <a data-link-type="dfn" href="#snapshot-state" id="ref-for-snapshot-state④">snapshot state</a> set to the state of the underlying storage on disk at the time the reference is taken.
If the file is modified on disk following the time a reference has been taken,
the <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file①③">File</a></code>'s <a data-link-type="dfn" href="#snapshot-state" id="ref-for-snapshot-state⑤">snapshot state</a> will differ from the state of the underlying storage.
User agents may use modification time stamps and other mechanisms to maintain <a data-link-type="dfn" href="#snapshot-state" id="ref-for-snapshot-state⑥">snapshot state</a>,
but this is left as an implementation detail.</p>
   <p>When a <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file①④">File</a></code> object refers to a file on disk,
user agents must return the <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type①①">type</a></code> of that file,
and must follow the <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="file-type-guidelines">file type guidelines</dfn> below:</p>
   <ul>
    <li data-md>
     <p>User agents must return the <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type①②">type</a></code> as an ASCII-encoded string in lower case,
such that when it is converted to a corresponding byte sequence,
it is a <a data-link-type="dfn" href="https://mimesniff.spec.whatwg.org/#parsable-mime-type" id="ref-for-parsable-mime-type②">parsable MIME type</a>,
or the empty string – 0 bytes – if the type cannot be determined.</p>
    <li data-md>
     <p>When the file is of type <code>text/plain</code> user agents must NOT append a charset parameter to the <i>dictionary of parameters</i> portion of the media type <a data-link-type="biblio" href="#biblio-mimesniff">[MIMESNIFF]</a>.</p>
    <li data-md>
     <p>User agents must not attempt heuristic determination of encoding,
including statistical methods.</p>
   </ul>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed①"><c- g>Exposed</c-></a>=(<c- n>Window</c->,<c- n>Worker</c->), <a class="idl-code" data-link-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#serializable" id="ref-for-serializable①"><c- g>Serializable</c-></a>]
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="dfn-file"><code><c- g>File</c-></code></dfn> : <a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob③②"><c- n>Blob</c-></a> {
  <dfn class="dfn-paneled idl-code" data-dfn-for="File" data-dfn-type="constructor" data-export data-lt="File(fileBits, fileName, options)|constructor(fileBits, fileName, options)|File(fileBits, fileName)|constructor(fileBits, fileName)" id="dom-file-file"><code><c- g>constructor</c-></code></dfn>(<c- b>sequence</c->&lt;<a class="n" data-link-type="idl-name" href="#typedefdef-blobpart" id="ref-for-typedefdef-blobpart②"><c- n>BlobPart</c-></a>> <a class="idl-code" data-link-type="argument" href="#dfn-fileBits" id="ref-for-dfn-fileBits"><c- g>fileBits</c-></a>,
              <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString⑤"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="argument" href="#dfn-fileName" id="ref-for-dfn-fileName"><c- g>fileName</c-></a>,
              <c- b>optional</c-> <a class="n" data-link-type="idl-name" href="#dfn-FilePropertyBag" id="ref-for-dfn-FilePropertyBag"><c- n>FilePropertyBag</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="File/File(fileBits, fileName, options), File/constructor(fileBits, fileName, options), File/File(fileBits, fileName), File/constructor(fileBits, fileName)" data-dfn-type="argument" data-export id="dom-file-file-filebits-filename-options-options"><code><c- g>options</c-></code></dfn> = {});
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString④"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="DOMString" href="#dfn-name" id="ref-for-dfn-name①"><c- g>name</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-long-long" id="ref-for-idl-long-long②"><c- b>long</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="long long" href="#dfn-lastModified" id="ref-for-dfn-lastModified"><c- g>lastModified</c-></a>;
};

<c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dfn-FilePropertyBag"><code><c- g>FilePropertyBag</c-></code></dfn> : <a class="n" data-link-type="idl-name" href="#dfn-BlobPropertyBag" id="ref-for-dfn-BlobPropertyBag③"><c- n>BlobPropertyBag</c-></a> {
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-long-long" id="ref-for-idl-long-long③"><c- b>long</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="long long " href="#dfn-FPdate" id="ref-for-dfn-FPdate"><c- g>lastModified</c-></a>;
};
</pre>
   <p><code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file①⑤">File</a></code> objects are <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#serializable-objects" id="ref-for-serializable-objects①">serializable objects</a>. Their <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#serialization-steps" id="ref-for-serialization-steps①">serialization steps</a>,
given <var>value</var> and <var>serialized</var>, are:</p>
   <ol>
    <li data-md>
     <p>Set <var>serialized</var>.[[SnapshotState]] to <var>value</var>’s <a data-link-type="dfn" href="#snapshot-state" id="ref-for-snapshot-state⑦">snapshot state</a>.</p>
    <li data-md>
     <p>Set <var>serialized</var>.[[ByteSequence]] to <var>value</var>’s underlying byte sequence.</p>
    <li data-md>
     <p>Set <var>serialized</var>.[[Name]] to the value of <var>value</var>’s <code class="idl"><a data-link-type="idl" href="#dfn-name" id="ref-for-dfn-name②">name</a></code> attribute.</p>
    <li data-md>
     <p>Set <var>serialized</var>.[[LastModified]] to the value of <var>value</var>’s <code class="idl"><a data-link-type="idl" href="#dfn-lastModified" id="ref-for-dfn-lastModified①">lastModified</a></code> attribute.</p>
   </ol>
   <p>Their <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#deserialization-steps" id="ref-for-deserialization-steps①">deserialization steps</a>, given <var>value</var> and <var>serialized</var>, are:</p>
   <ol>
    <li data-md>
     <p>Set <var>value</var>’s <a data-link-type="dfn" href="#snapshot-state" id="ref-for-snapshot-state⑧">snapshot state</a> to <var>serialized</var>.[[SnapshotState]].</p>
    <li data-md>
     <p>Set <var>value</var>’s underlying byte sequence to <var>serialized</var>.[[ByteSequence]].</p>
    <li data-md>
     <p>Initialize the value of <var>value</var>’s <code class="idl"><a data-link-type="idl" href="#dfn-name" id="ref-for-dfn-name③">name</a></code> attribute to <var>serialized</var>.[[Name]].</p>
    <li data-md>
     <p>Initialize the value of <var>value</var>’s <code class="idl"><a data-link-type="idl" href="#dfn-lastModified" id="ref-for-dfn-lastModified②">lastModified</a></code> attribute to <var>serialized</var>.[[LastModified]].</p>
   </ol>
   <h3 class="heading settled" data-level="4.1" id="file-constructor"><span class="secno">4.1. </span><span class="content">Constructor</span><a class="self-link" href="#file-constructor"></a></h3>
   <div class="algorithm" data-algorithm="file-constructor">
     The <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file①⑥">File</a></code> constructor is invoked with two or three parameters,
depending on whether the optional dictionary parameter is used.
When the <code class="idl"><a data-link-type="idl" href="#dom-file-file" id="ref-for-dom-file-file">File()</a></code> constructor is invoked,
user agents must run the following steps: 
    <ol>
     <li data-md>
      <p>Let <var>bytes</var> be the result of <a data-link-type="dfn" href="#process-blob-parts" id="ref-for-process-blob-parts①">processing blob parts</a> given <code class="idl"><a data-link-type="idl" href="#dfn-fileBits" id="ref-for-dfn-fileBits①">fileBits</a></code> and <code class="idl"><a data-link-type="idl" href="#dom-file-file-filebits-filename-options-options" id="ref-for-dom-file-file-filebits-filename-options-options">options</a></code>.</p>
     <li data-md>
      <p>Let <var>n</var> be a new string of the same size as the <code class="idl"><a data-link-type="idl" href="#dfn-fileName" id="ref-for-dfn-fileName①">fileName</a></code> argument to the constructor.
Copy every character from <code class="idl"><a data-link-type="idl" href="#dfn-fileName" id="ref-for-dfn-fileName②">fileName</a></code> to <var>n</var>,
replacing any "/" character (U+002F SOLIDUS) with a ":" (U+003A COLON).</p>
      <p class="note" role="note"><span>Note:</span> Underlying OS filesystems use differing conventions for file name;
with constructed files, mandating UTF-16 lessens ambiquity when file names are converted to <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte" id="ref-for-byte①⓪">byte</a> sequences.</p>
     <li data-md>
      <p>Process <code class="idl"><a data-link-type="idl" href="#dfn-FilePropertyBag" id="ref-for-dfn-FilePropertyBag①">FilePropertyBag</a></code> dictionary argument by running the following substeps:</p>
      <ol>
       <li data-md>
        <p>If the <code class="idl"><a data-link-type="idl" href="#dfn-BPtype" id="ref-for-dfn-BPtype③">type</a></code> member is provided and is not the empty string,
let <var>t</var> be set to the <code class="idl"><a data-link-type="idl" href="#dfn-BPtype" id="ref-for-dfn-BPtype④">type</a></code> dictionary member.
If <var>t</var> contains any characters outside the range U+0020 to U+007E,
then set <var>t</var> to the empty string and return from these substeps.</p>
       <li data-md>
        <p>Convert every character in <var>t</var> to <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-lowercase" id="ref-for-ascii-lowercase②">ASCII lowercase</a>.</p>
       <li data-md>
        <p>If the <code class="idl"><a data-link-type="idl" href="#dfn-FPdate" id="ref-for-dfn-FPdate①">lastModified</a></code> member is provided,
let <var>d</var> be set to the <code class="idl"><a data-link-type="idl" href="#dfn-FPdate" id="ref-for-dfn-FPdate②">lastModified</a></code> dictionary member.
If it is not provided,
set <var>d</var> to the current date and time
represented as the number of milliseconds since the <a data-link-type="dfn" href="#UnixEpoch" id="ref-for-UnixEpoch">Unix Epoch</a> (which is the equivalent of <code>Date.now()</code> <a data-link-type="biblio" href="#biblio-ecma-262">[ECMA-262]</a>).</p>
        <p class="note" role="note"><span>Note:</span> Since ECMA-262 <code class="idl"><a data-link-type="idl" href="http://tc39.github.io/ecma262/#sec-date-constructor" id="ref-for-sec-date-constructor">Date</a></code> objects convert to <code>long long</code> values
representing the number of milliseconds since the <a data-link-type="dfn" href="#UnixEpoch" id="ref-for-UnixEpoch①">Unix Epoch</a>,
the <code class="idl"><a data-link-type="idl" href="#dfn-FPdate" id="ref-for-dfn-FPdate③">lastModified</a></code> member could be a <code class="idl"><a data-link-type="idl" href="http://tc39.github.io/ecma262/#sec-date-constructor" id="ref-for-sec-date-constructor①">Date</a></code> object <a data-link-type="biblio" href="#biblio-ecma-262">[ECMA-262]</a>.</p>
      </ol>
     <li data-md>
      <p>Return a new <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file①⑦">File</a></code> object <var>F</var> such that:</p>
      <ol start="2">
       <li data-md>
        <p><var>F</var> refers to the <var>bytes</var> <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte" id="ref-for-byte①①">byte</a> sequence.</p>
       <li data-md>
        <p><var>F</var>.<code class="idl"><a data-link-type="idl" href="#dfn-size" id="ref-for-dfn-size⑦">size</a></code> is set to the number of total bytes in <var>bytes</var>.</p>
       <li data-md>
        <p><var>F</var>.<code class="idl"><a data-link-type="idl" href="#dfn-name" id="ref-for-dfn-name④">name</a></code> is set to <var>n</var>.</p>
       <li data-md>
        <p><var>F</var>.<code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type①③">type</a></code> is set to <var>t</var>.</p>
       <li data-md>
        <p><var>F</var>.<code class="idl"><a data-link-type="idl" href="#dfn-lastModified" id="ref-for-dfn-lastModified③">lastModified</a></code> is set to <var>d</var>.</p>
      </ol>
    </ol>
   </div>
   <h4 class="heading settled" data-level="4.1.1" id="file-constructor-params"><span class="secno">4.1.1. </span><span class="content">Constructor Parameters</span><a class="self-link" href="#file-constructor-params"></a></h4>
   <p>The <code class="idl"><a data-link-type="idl" href="#dom-file-file" id="ref-for-dom-file-file①">File()</a></code> constructor can be invoked with the parameters below:</p>
   <dl>
    <dt>A <dfn class="dfn-paneled idl-code" data-dfn-for="File/File(fileBits, fileName, options)" data-dfn-type="argument" data-export id="dfn-fileBits"><code>fileBits</code></dfn> <code>sequence</code> 
    <dd>
     which takes any number of the following elements, and in any order: 
     <ul>
      <li data-md>
       <p><code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#BufferSource" id="ref-for-BufferSource③">BufferSource</a></code> elements.</p>
      <li data-md>
       <p><code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob③③">Blob</a></code> elements, which includes <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file①⑧">File</a></code> elements.</p>
      <li data-md>
       <p><code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString⑥">USVString</a></code> elements.</p>
     </ul>
    <dt>A <dfn class="dfn-paneled idl-code" data-dfn-for="File/File(fileBits, fileName, options)" data-dfn-type="argument" data-export id="dfn-fileName"><code>fileName</code></dfn> parameter 
    <dd>A <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString⑦">USVString</a></code> parameter representing the name of the file;
    normative conditions for this constructor parameter can be found in <a href="#file-constructor">§ 4.1 Constructor</a>. 
    <dt id="def-Properties"><a class="self-link" href="#def-Properties"></a>An optional <code class="idl"><a data-link-type="idl" href="#dfn-FilePropertyBag" id="ref-for-dfn-FilePropertyBag②">FilePropertyBag</a></code> dictionary 
    <dd>
     which in addition to the <a href="#dfn-BlobPropertyBagMembers">members</a> of <code class="idl"><a data-link-type="idl" href="#dfn-BlobPropertyBag" id="ref-for-dfn-BlobPropertyBag④">BlobPropertyBag</a></code> takes one member: 
     <ul>
      <li data-md>
       <p>An optional <dfn class="dfn-paneled idl-code" data-dfn-for="FilePropertyBag" data-dfn-type="dict-member" data-export id="dfn-FPdate"><code>lastModified</code></dfn> member,
which must be a <code>long long</code>;
normative conditions for this member are provided in <a href="#file-constructor">§ 4.1 Constructor</a>.</p>
     </ul>
   </dl>
   <h3 class="heading settled" data-level="4.2" id="file-attrs"><span class="secno">4.2. </span><span class="content">Attributes</span><a class="self-link" href="#file-attrs"></a></h3>
   <dl>
    <dt><dfn class="dfn-paneled idl-code" data-dfn-for="File" data-dfn-type="attribute" data-export id="dfn-name"><code>name</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString⑤">DOMString</a>, readonly</span>
    <dd>The name of the file.
    On getting, this must return the name of the file as a string.
    There are numerous file name variations and conventions used by different underlying OS file systems;
    this is merely the name of the file, without path information.
    On getting, if user agents cannot make this information available,
    they must return the empty string.
    If a <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file①⑨">File</a></code> object is created using a constructor,
    further normative conditions for this attribute are found in <a href="#file-constructor">§ 4.1 Constructor</a>. 
    <dt><dfn class="dfn-paneled idl-code" data-dfn-for="File" data-dfn-type="attribute" data-export id="dfn-lastModified"><code>lastModified</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://heycam.github.io/webidl/#idl-long-long" id="ref-for-idl-long-long④">long long</a>, readonly</span>
    <dd>The last modified date of the file.
    On getting, if user agents can make this information available,
    this must return a <code>long long</code> set to the time the file was last modified
    as the number of milliseconds since the <a data-link-type="dfn" href="#UnixEpoch" id="ref-for-UnixEpoch②">Unix Epoch</a>.
    If the last modification date and time are not known,
    the attribute must return the current date and time
    as a <code>long long</code> representing the number of milliseconds since the <a data-link-type="dfn" href="#UnixEpoch" id="ref-for-UnixEpoch③">Unix Epoch</a>;
    this is equivalent to <code class="lang-javascript highlight">Date<c- p>.</c->now<c- p>()</c-></code> <a data-link-type="biblio" href="#biblio-ecma-262">[ECMA-262]</a>.
    If a <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file②⓪">File</a></code> object is created using a constructor,
    further normative conditions for this attribute are found in <a href="#file-constructor">§ 4.1 Constructor</a>. 
   </dl>
   <p>The <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file②①">File</a></code> interface is available on objects that expose an attribute of type <code class="idl"><a data-link-type="idl" href="#dfn-filelist" id="ref-for-dfn-filelist①">FileList</a></code>;
these objects are defined in HTML <a data-link-type="biblio" href="#biblio-html">[HTML]</a>.
The <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file②②">File</a></code> interface, which inherits from <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob③④">Blob</a></code>, is immutable,
and thus represents file data that can be read into memory at the time a <a data-link-type="dfn" href="#readOperation" id="ref-for-readOperation">read operation</a> is initiated.
User agents must process reads on files that no longer exist at the time of read as <a data-link-type="dfn" href="#file-error-read" id="ref-for-file-error-read①">errors</a>,
throwing a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#notfounderror" id="ref-for-notfounderror">NotFoundError</a></code> exception
if using a <code class="idl"><a data-link-type="idl" href="#dfn-FileReaderSync" id="ref-for-dfn-FileReaderSync①">FileReaderSync</a></code> on a Web Worker <a data-link-type="biblio" href="#biblio-workers">[Workers]</a> or firing an <code class="idl"><a class="idl-code" data-link-type="event" href="#dfn-error-event" id="ref-for-dfn-error-event">error</a></code> event
with the <code class="idl"><a class="idl-code" data-link-type="attribute" href="#dom-filereader-error" id="ref-for-dom-filereader-error">error</a></code> attribute returning a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#notfounderror" id="ref-for-notfounderror①">NotFoundError</a></code>.</p>
   <div class="example" id="example-c4014f19">
    <a class="self-link" href="#example-c4014f19"></a> In the examples below, metadata from a file object is displayed meaningfully, and a file object is created with a name and a last modified date. 
<pre class="lang-javascript highlight"><c- a>var</c-> file <c- o>=</c-> document<c- p>.</c->getElementById<c- p>(</c-><c- u>"filePicker"</c-><c- p>).</c->files<c- p>[</c-><c- mi>0</c-><c- p>];</c->
<c- a>var</c-> date <c- o>=</c-> <c- k>new</c-> Date<c- p>(</c->file<c- p>.</c->lastModified<c- p>);</c->
println<c- p>(</c-><c- u>"You selected the file "</c-> <c- o>+</c-> file<c- p>.</c->name <c- o>+</c-> <c- u>" which was modified on "</c-> <c- o>+</c-> date<c- p>.</c->toDateString<c- p>()</c-> <c- o>+</c-> <c- u>"."</c-><c- p>);</c->

<c- p>...</c->

<c- c1>// Generate a file with a specific last modified date</c->

<c- a>var</c-> d <c- o>=</c-> <c- k>new</c-> Date<c- p>(</c-><c- mi>2013</c-><c- p>,</c-> <c- mi>12</c-><c- p>,</c-> <c- mi>5</c-><c- p>,</c-> <c- mi>16</c-><c- p>,</c-> <c- mi>23</c-><c- p>,</c-> <c- mi>45</c-><c- p>,</c-> <c- mi>600</c-><c- p>);</c->
<c- a>var</c-> generatedFile <c- o>=</c-> <c- k>new</c-> File<c- p>([</c-><c- u>"Rough Draft ...."</c-><c- p>],</c-> <c- u>"Draft1.txt"</c-><c- p>,</c-> <c- p>{</c->type<c- o>:</c-> <c- u>"text/plain"</c-><c- p>,</c-> lastModified<c- o>:</c-> d<c- p>})</c->

<c- p>...</c->
</pre>
   </div>
   <h2 class="heading settled" data-level="5" id="filelist-section"><span class="secno">5. </span><span class="content">The FileList Interface</span><a class="self-link" href="#filelist-section"></a></h2>
   <p class="note" role="note"><span>Note:</span> The <code class="idl"><a data-link-type="idl" href="#dfn-filelist" id="ref-for-dfn-filelist②">FileList</a></code> interface should be considered "at risk"
since the general trend on the Web Platform is to replace such interfaces
with the <code class="idl"><a data-link-type="idl" href="http://tc39.github.io/ecma262/#sec-array-constructor" id="ref-for-sec-array-constructor">Array</a></code> platform object in ECMAScript <a data-link-type="biblio" href="#biblio-ecma-262">[ECMA-262]</a>.
In particular, this means syntax of the sort <code class="lang-javascript highlight">filelist<c- p>.</c->item<c- p>(</c-><c- mi>0</c-><c- p>)</c-></code> is at risk;
most other programmatic use of <code class="idl"><a data-link-type="idl" href="#dfn-filelist" id="ref-for-dfn-filelist③">FileList</a></code> is unlikely to be affected by the eventual migration to an <code class="idl"><a data-link-type="idl" href="http://tc39.github.io/ecma262/#sec-array-constructor" id="ref-for-sec-array-constructor①">Array</a></code> type.</p>
   <p>This interface is a list of <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file②③">File</a></code> objects.</p>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed②"><c- g>Exposed</c-></a>=(<c- n>Window</c->,<c- n>Worker</c->), <a class="idl-code" data-link-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#serializable" id="ref-for-serializable②"><c- g>Serializable</c-></a>]
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="dfn-filelist"><code><c- g>FileList</c-></code></dfn> {
  <c- b>getter</c-> <a class="n" data-link-type="idl-name" href="#dfn-file" id="ref-for-dfn-file②④"><c- n>File</c-></a>? <a class="idl-code" data-link-type="method" href="#dfn-item" id="ref-for-dfn-item"><c- g>item</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-long" id="ref-for-idl-unsigned-long"><c- b>unsigned</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="argument" href="#dfn-index" id="ref-for-dfn-index"><c- g>index</c-></a>);
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-long" id="ref-for-idl-unsigned-long①"><c- b>unsigned</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="unsigned long" href="#dfn-length" id="ref-for-dfn-length"><c- g>length</c-></a>;
};
</pre>
   <p><code class="idl"><a data-link-type="idl" href="#dfn-filelist" id="ref-for-dfn-filelist④">FileList</a></code> objects are <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#serializable-objects" id="ref-for-serializable-objects②">serializable objects</a>. Their <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#serialization-steps" id="ref-for-serialization-steps②">serialization steps</a>,
given <var>value</var> and <var>serialized</var>, are:</p>
   <ol>
    <li data-md>
     <p>Set <var>serialized</var>.[[Files]] to an empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list">list</a>.</p>
    <li data-md>
     <p>For each <var>file</var> in <var>value</var>, append the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#sub-serialization" id="ref-for-sub-serialization">sub-serialization</a> of <var>file</var> to <var>serialized</var>.[[Files]].</p>
   </ol>
   <p>Their <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#deserialization-steps" id="ref-for-deserialization-steps②">deserialization step</a>, given <var>serialized</var> and <var>value</var>, are:</p>
   <ol>
    <li data-md>
     <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate">For each</a> <var>file</var> of <var>serialized</var>.[[Files]], add the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/structured-data.html#sub-deserialization" id="ref-for-sub-deserialization">sub-deserialization</a> of <var>file</var> to <var>value</var>.</p>
   </ol>
   <div class="example" id="example-47506268">
    <a class="self-link" href="#example-47506268"></a> Sample usage typically involves DOM access to the <code>&lt;input type="file"></code> element within a form,
  and then accessing selected files. 
<pre class="lang-javascript highlight"><c- c1>// uploadData is a form element</c->
<c- c1>// fileChooser is input element of type 'file'</c->
<c- a>var</c-> file <c- o>=</c-> document<c- p>.</c->forms<c- p>[</c-><c- t>'uploadData'</c-><c- p>][</c-><c- t>'fileChooser'</c-><c- p>].</c->files<c- p>[</c-><c- mi>0</c-><c- p>];</c->

<c- c1>// alternative syntax can be</c->
<c- c1>// var file = document.forms['uploadData']['fileChooser'].files.item(0);</c->

<c- k>if</c-><c- p>(</c->file<c- p>)</c->
<c- p>{</c->
  <c- c1>// Perform file ops</c->
<c- p>}</c->
</pre>
   </div>
   <h3 class="heading settled" data-level="5.1" id="attributes-filelist"><span class="secno">5.1. </span><span class="content">Attributes</span><a class="self-link" href="#attributes-filelist"></a></h3>
   <dl>
    <dt><dfn class="dfn-paneled idl-code" data-dfn-for="FileList" data-dfn-type="attribute" data-export id="dfn-length"><code>length</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://heycam.github.io/webidl/#idl-unsigned-long" id="ref-for-idl-unsigned-long②">unsigned long</a>, readonly</span>
    <dd>must return the number of files in the <code class="idl"><a data-link-type="idl" href="#dfn-filelist" id="ref-for-dfn-filelist⑤">FileList</a></code> object.
      If there are no files, this attribute must return 0. 
   </dl>
   <h3 class="heading settled" data-level="5.2" id="filelist-methods-params"><span class="secno">5.2. </span><span class="content">Methods and Parameters</span><a class="self-link" href="#filelist-methods-params"></a></h3>
   <dl>
    <dt><dfn class="dfn-paneled idl-code" data-dfn-for="FileList" data-dfn-type="method" data-export id="dfn-item"><code>item(index)</code></dfn> 
    <dd>
     must return the <var>index</var>th <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file②⑤">File</a></code> object in the <code class="idl"><a data-link-type="idl" href="#dfn-filelist" id="ref-for-dfn-filelist⑥">FileList</a></code>.
    If there is no <var>index</var>th <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file②⑥">File</a></code> object in the <code class="idl"><a data-link-type="idl" href="#dfn-filelist" id="ref-for-dfn-filelist⑦">FileList</a></code>,
    then this method must return <code>null</code>. 
     <p><dfn class="dfn-paneled idl-code" data-dfn-for="FileList/item(index)" data-dfn-type="argument" data-export id="dfn-index"><code>index</code></dfn> must be treated by user agents
    as value for the position of a <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file②⑦">File</a></code> object in the <code class="idl"><a data-link-type="idl" href="#dfn-filelist" id="ref-for-dfn-filelist⑧">FileList</a></code>,
    with 0 representing the first file. <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-supported-property-indices" id="ref-for-dfn-supported-property-indices">Supported property indices</a> are the numbers in the range zero
    to one less than the number of <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file②⑧">File</a></code> objects represented by the <code class="idl"><a data-link-type="idl" href="#dfn-filelist" id="ref-for-dfn-filelist⑨">FileList</a></code> object.
    If there are no such <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file②⑨">File</a></code> objects,
    then there are no supported property indices.</p>
   </dl>
   <p class="note" role="note"><span>Note:</span> The <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/input.html#htmlinputelement" id="ref-for-htmlinputelement">HTMLInputElement</a></code> interface has a readonly attribute of type <code class="idl"><a data-link-type="idl" href="#dfn-filelist" id="ref-for-dfn-filelist①⓪">FileList</a></code>,
which is what is being accessed in the above example.
Other interfaces with a readonly attribute of type <code class="idl"><a data-link-type="idl" href="#dfn-filelist" id="ref-for-dfn-filelist①①">FileList</a></code> include the <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/dnd.html#datatransfer" id="ref-for-datatransfer①">DataTransfer</a></code> interface.</p>
   <h2 class="heading settled" data-level="6" id="reading-data-section"><span class="secno">6. </span><span class="content">Reading Data</span><a class="self-link" href="#reading-data-section"></a></h2>
   <h3 class="heading settled" data-level="6.1" id="blobreader-task-source"><span class="secno">6.1. </span><span class="content">The File Reading Task Source</span><a class="self-link" href="#blobreader-task-source"></a></h3>
   <p>This specification defines a new generic <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#task-source" id="ref-for-task-source">task source</a> called the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="fileReadingTaskSource">file reading task source</dfn>,
which is used for all <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task" id="ref-for-queue-a-task">tasks that are queued</a> in this specification
to read byte sequences associated with <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob③⑤">Blob</a></code> and <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file③⓪">File</a></code> objects.
It is to be used for features that trigger in response to asynchronously reading binary data.</p>
   <h3 class="heading settled" data-level="6.2" id="APIASynch"><span class="secno">6.2. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader④">FileReader</a></code> API</span><a class="self-link" href="#APIASynch"></a></h3>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed③"><c- g>Exposed</c-></a>=(<c- n>Window</c->,<c- n>Worker</c->)]
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="dfn-filereader"><code><c- g>FileReader</c-></code></dfn>: <a class="n" data-link-type="idl-name" href="https://dom.spec.whatwg.org/#eventtarget" id="ref-for-eventtarget"><c- n>EventTarget</c-></a> {
  <a class="idl-code" data-link-type="constructor" href="#filereaderConstrctr" id="ref-for-filereaderConstrctr"><c- g>constructor</c-></a>();
  // async read methods
  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dfn-readAsArrayBuffer" id="ref-for-dfn-readAsArrayBuffer"><c- g>readAsArrayBuffer</c-></a>(<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob③⑥"><c- n>Blob</c-></a> <dfn class="idl-code" data-dfn-for="FileReader/readAsArrayBuffer(blob)" data-dfn-type="argument" data-export id="dom-filereader-readasarraybuffer-blob-blob"><code><c- g>blob</c-></code><a class="self-link" href="#dom-filereader-readasarraybuffer-blob-blob"></a></dfn>);
  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dfn-readAsBinaryString" id="ref-for-dfn-readAsBinaryString"><c- g>readAsBinaryString</c-></a>(<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob③⑦"><c- n>Blob</c-></a> <dfn class="idl-code" data-dfn-for="FileReader/readAsBinaryString(blob)" data-dfn-type="argument" data-export id="dom-filereader-readasbinarystring-blob-blob"><code><c- g>blob</c-></code><a class="self-link" href="#dom-filereader-readasbinarystring-blob-blob"></a></dfn>);
  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dfn-readAsText" id="ref-for-dfn-readAsText①"><c- g>readAsText</c-></a>(<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob③⑧"><c- n>Blob</c-></a> <dfn class="idl-code" data-dfn-for="FileReader/readAsText(blob, encoding), FileReader/readAsText(blob)" data-dfn-type="argument" data-export id="dom-filereader-readastext-blob-encoding-blob"><code><c- g>blob</c-></code><a class="self-link" href="#dom-filereader-readastext-blob-encoding-blob"></a></dfn>, <c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString⑥"><c- b>DOMString</c-></a> <dfn class="idl-code" data-dfn-for="FileReader/readAsText(blob, encoding), FileReader/readAsText(blob)" data-dfn-type="argument" data-export id="dom-filereader-readastext-blob-encoding-encoding"><code><c- g>encoding</c-></code><a class="self-link" href="#dom-filereader-readastext-blob-encoding-encoding"></a></dfn>);
  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dfn-readAsDataURL" id="ref-for-dfn-readAsDataURL"><c- g>readAsDataURL</c-></a>(<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob③⑨"><c- n>Blob</c-></a> <dfn class="idl-code" data-dfn-for="FileReader/readAsDataURL(blob)" data-dfn-type="argument" data-export id="dom-filereader-readasdataurl-blob-blob"><code><c- g>blob</c-></code><a class="self-link" href="#dom-filereader-readasdataurl-blob-blob"></a></dfn>);

  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dfn-abort" id="ref-for-dfn-abort①"><c- g>abort</c-></a>();

  // states
  <c- b>const</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-short" id="ref-for-idl-unsigned-short"><c- b>unsigned</c-> <c- b>short</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="const" data-export id="dom-filereader-empty"><code><c- g>EMPTY</c-></code></dfn> = 0;
  <c- b>const</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-short" id="ref-for-idl-unsigned-short①"><c- b>unsigned</c-> <c- b>short</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="const" data-export id="dom-filereader-loading"><code><c- g>LOADING</c-></code></dfn> = 1;
  <c- b>const</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-short" id="ref-for-idl-unsigned-short②"><c- b>unsigned</c-> <c- b>short</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="const" data-export id="dom-filereader-done"><code><c- g>DONE</c-></code></dfn> = 2;

  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-short" id="ref-for-idl-unsigned-short③"><c- b>unsigned</c-> <c- b>short</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="unsigned short" href="#dom-filereader-readystate" id="ref-for-dom-filereader-readystate"><c- g>readyState</c-></a>;

  // File or Blob data
  <c- b>readonly</c-> <c- b>attribute</c-> (<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString⑦"><c- b>DOMString</c-></a> <c- b>or</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer②"><c- b>ArrayBuffer</c-></a>)? <a class="idl-code" data-link-type="attribute" data-readonly data-type="(DOMString or ArrayBuffer)?" href="#dom-filereader-result" id="ref-for-dom-filereader-result"><c- g>result</c-></a>;

  <c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://heycam.github.io/webidl/#idl-DOMException" id="ref-for-idl-DOMException"><c- n>DOMException</c-></a>? <a class="idl-code" data-link-type="attribute" data-readonly data-type="DOMException?" href="#dom-filereader-error" id="ref-for-dom-filereader-error①"><c- g>error</c-></a>;

  // event handler content attributes
  <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler" id="ref-for-eventhandler"><c- n>EventHandler</c-></a> <a class="idl-code" data-link-type="attribute" data-type="EventHandler" href="#dfn-onloadstart" id="ref-for-dfn-onloadstart"><c- g>onloadstart</c-></a>;
  <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler" id="ref-for-eventhandler①"><c- n>EventHandler</c-></a> <a class="idl-code" data-link-type="attribute" data-type="EventHandler" href="#dfn-onprogress" id="ref-for-dfn-onprogress"><c- g>onprogress</c-></a>;
  <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler" id="ref-for-eventhandler②"><c- n>EventHandler</c-></a> <a class="idl-code" data-link-type="attribute" data-type="EventHandler" href="#dfn-onload" id="ref-for-dfn-onload"><c- g>onload</c-></a>;
  <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler" id="ref-for-eventhandler③"><c- n>EventHandler</c-></a> <a class="idl-code" data-link-type="attribute" data-type="EventHandler" href="#dfn-onabort" id="ref-for-dfn-onabort"><c- g>onabort</c-></a>;
  <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler" id="ref-for-eventhandler④"><c- n>EventHandler</c-></a> <a class="idl-code" data-link-type="attribute" data-type="EventHandler" href="#dfn-onerror" id="ref-for-dfn-onerror"><c- g>onerror</c-></a>;
  <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler" id="ref-for-eventhandler⑤"><c- n>EventHandler</c-></a> <a class="idl-code" data-link-type="attribute" data-type="EventHandler" href="#dfn-onloadend" id="ref-for-dfn-onloadend"><c- g>onloadend</c-></a>;
};
</pre>
   <p>A <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader⑤">FileReader</a></code> has an associated <dfn class="dfn-paneled" data-dfn-for="FileReader" data-dfn-type="dfn" data-noexport id="filereader-state">state</dfn>,
that is <code>"empty"</code>, <code>"loading"</code>, or <code>"done"</code>. It is initially <code>"empty"</code>.</p>
   <p>A <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader⑥">FileReader</a></code> has an associated <dfn class="dfn-paneled" data-dfn-for="FileReader" data-dfn-type="dfn" data-noexport id="filereader-result">result</dfn> (<code>null</code>, a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString⑧">DOMString</a></code> or an <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer③">ArrayBuffer</a></code>). It is initially <code>null</code>.</p>
   <p>A <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader⑦">FileReader</a></code> has an associated <dfn class="dfn-paneled" data-dfn-for="FileReader" data-dfn-type="dfn" data-noexport id="filereader-error">error</dfn> (<code>null</code> or a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#idl-DOMException" id="ref-for-idl-DOMException①">DOMException</a></code>). It is initially <code>null</code>.</p>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="constructor" data-export data-lt="FileReader()|constructor()" id="filereaderConstrctr"><code>FileReader()</code></dfn> constructor,
when invoked, must return a new <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader⑧">FileReader</a></code> object.</p>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="attribute" data-export id="dom-filereader-readystate"><code>readyState</code></dfn> attribute’s getter,
when invoked, switches on the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object④">context object</a>'s <a data-link-type="dfn" href="#filereader-state" id="ref-for-filereader-state">state</a> and runs the associated step:</p>
   <dl>
    <dt data-md><code>"empty"</code>
    <dd data-md>
     <p>Return <code class="idl"><a data-link-type="idl" href="#dom-filereader-empty" id="ref-for-dom-filereader-empty">EMPTY</a></code></p>
    <dt data-md><code>"loading"</code>
    <dd data-md>
     <p>Return <code class="idl"><a data-link-type="idl" href="#dom-filereader-loading" id="ref-for-dom-filereader-loading">LOADING</a></code></p>
    <dt data-md><code>"done"</code>
    <dd data-md>
     <p>Return <code class="idl"><a data-link-type="idl" href="#dom-filereader-done" id="ref-for-dom-filereader-done">DONE</a></code></p>
   </dl>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="attribute" data-export id="dom-filereader-result"><code>result</code></dfn> attribute’s getter,
when invoked, must return the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object⑤">context object</a>'s <a data-link-type="dfn" href="#filereader-result" id="ref-for-filereader-result">result</a>.</p>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="attribute" data-export id="dom-filereader-error"><code>error</code></dfn> attribute’s getter,
when invoked, must return the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object⑥">context object</a>'s <a data-link-type="dfn" href="#filereader-error" id="ref-for-filereader-error">error</a>.</p>
   <div class="algorithm" data-algorithm="read operation">
     A <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader⑨">FileReader</a></code> <var>fr</var> has an associated <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="readOperation">read operation</dfn> algorithm,
which given <var>blob</var>, a <var>type</var> and an optional <var>encodingName</var>,
runs the following steps: 
    <ol>
     <li data-md>
      <p>If <var>fr</var>’s <a data-link-type="dfn" href="#filereader-state" id="ref-for-filereader-state①">state</a> is <code>"loading"</code>,
 throw an <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#invalidstateerror" id="ref-for-invalidstateerror">InvalidStateError</a></code> <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#idl-DOMException" id="ref-for-idl-DOMException②">DOMException</a></code>.</p>
     <li data-md>
      <p>Set <var>fr</var>’s <a data-link-type="dfn" href="#filereader-state" id="ref-for-filereader-state②">state</a> to <code>"loading"</code>.</p>
     <li data-md>
      <p>Set <var>fr</var>’s <a data-link-type="dfn" href="#filereader-result" id="ref-for-filereader-result①">result</a> to <code>null</code>.</p>
     <li data-md>
      <p>Set <var>fr</var>’s <a data-link-type="dfn" href="#filereader-error" id="ref-for-filereader-error①">error</a> to <code>null</code>.</p>
     <li data-md>
      <p>Let <var>stream</var> be the result of calling <a data-link-type="dfn" href="#blob-get-stream" id="ref-for-blob-get-stream③">get stream</a> on <var>blob</var>.</p>
     <li data-md>
      <p>Let <var>reader</var> be the result of <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-get-reader" id="ref-for-concept-get-reader②">getting a reader</a> from <var>stream</var>.</p>
     <li data-md>
      <p>Let <var>bytes</var> by an empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence" id="ref-for-byte-sequence①">byte sequence</a>.</p>
     <li data-md>
      <p>Let <var>chunkPromise</var> be the result of <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-read-chunk-from-readablestream" id="ref-for-concept-read-chunk-from-readablestream">reading a chunk</a> from <var>stream</var> with <var>reader</var>.</p>
     <li data-md>
      <p>Let <var>isFirstChunk</var> be true.</p>
     <li data-md>
      <p><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel" id="ref-for-in-parallel①">In parallel</a>, while true:</p>
      <ol>
       <li data-md>
        <p>Wait for <var>chunkPromise</var> to be fulfilled or rejected.</p>
       <li data-md>
        <p>If <var>chunkPromise</var> is fulfilled, and <var>isFirstChunk</var> is true, <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task" id="ref-for-queue-a-task①">queue a task</a> to <a data-link-type="dfn" href="#fire-a-progress-event" id="ref-for-fire-a-progress-event">fire a progress event</a> called <code class="idl"><a data-link-type="idl" href="#dfn-loadstart-event" id="ref-for-dfn-loadstart-event">loadstart</a></code> at <var>fr</var>.</p>
        <p class="issue" id="issue-0504580b"><a class="self-link" href="#issue-0504580b"></a> We might change <code class="idl"><a data-link-type="idl" href="#dfn-loadstart-event" id="ref-for-dfn-loadstart-event①">loadstart</a></code> to be dispatched synchronously,
 to align with XMLHttpRequest behavior. <a href="https://github.com/w3c/FileAPI/issues/119">&lt;https://github.com/w3c/FileAPI/issues/119></a></p>
       <li data-md>
        <p>Set <var>isFirstChunk</var> to false.</p>
       <li data-md>
        <p>If <var>chunkPromise</var> is fulfilled with an object whose <code>done</code> property is false and whose <code>value</code> property is a <code>Uint8Array</code> object, run these steps:</p>
        <ol>
         <li data-md>
          <p>Let <var>bs</var> be the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence" id="ref-for-byte-sequence②">byte sequence</a> represented by the <code>Uint8Array</code> object.</p>
         <li data-md>
          <p>Append <var>bs</var> to <var>bytes</var>.</p>
         <li data-md>
          <p>If roughly 50ms have passed since these steps were last invoked, <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task" id="ref-for-queue-a-task②">queue a task</a> to <a data-link-type="dfn" href="#fire-a-progress-event" id="ref-for-fire-a-progress-event①">fire a progress event</a> called <code class="idl"><a data-link-type="idl" href="#dfn-progress-event" id="ref-for-dfn-progress-event">progress</a></code> at <var>fr</var>.</p>
         <li data-md>
          <p>Set <var>chunkPromise</var> to the result of <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-read-chunk-from-readablestream" id="ref-for-concept-read-chunk-from-readablestream①">reading a chunk</a> from <var>stream</var> with <var>reader</var>.</p>
        </ol>
       <li data-md>
        <p>Otherwise, if <var>chunkPromise</var> is fulfilled with an object whose <code>done</code> property is true, <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task" id="ref-for-queue-a-task③">queue a task</a> to run the following steps and abort this algorithm:</p>
        <ol>
         <li data-md>
          <p>Set <var>fr</var>’s <a data-link-type="dfn" href="#filereader-state" id="ref-for-filereader-state③">state</a> to <code>"done"</code>.</p>
         <li data-md>
          <p>Let <var>result</var> be the result of <a data-link-type="dfn" href="#blob-package-data" id="ref-for-blob-package-data①">package data</a> given <var>bytes</var>, <var>type</var>, <var>blob</var>’s <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type①④">type</a></code>, and <var>encodingName</var>.</p>
         <li data-md>
          <p>If <a data-link-type="dfn" href="#blob-package-data" id="ref-for-blob-package-data②">package data</a> threw an exception <var>error</var>:</p>
          <ol>
           <li data-md>
            <p>Set <var>fr</var>’s <a data-link-type="dfn" href="#filereader-error" id="ref-for-filereader-error②">error</a> to <var>error</var>.</p>
           <li data-md>
            <p><a data-link-type="dfn" href="#fire-a-progress-event" id="ref-for-fire-a-progress-event②">Fire a progress event</a> called <code class="idl"><a class="idl-code" data-link-type="event" href="#dfn-error-event" id="ref-for-dfn-error-event①">error</a></code> at <var>fr</var>.</p>
          </ol>
         <li data-md>
          <p>Else:</p>
          <ol>
           <li data-md>
            <p>Set <var>fr</var>’s <a data-link-type="dfn" href="#filereader-result" id="ref-for-filereader-result②">result</a> to <var>result</var>.</p>
           <li data-md>
            <p><a data-link-type="dfn" href="#fire-a-progress-event" id="ref-for-fire-a-progress-event③">Fire a progress event</a> called <code class="idl"><a data-link-type="idl" href="#dfn-load-event" id="ref-for-dfn-load-event">load</a></code> at the <var>fr</var>.</p>
          </ol>
         <li data-md>
          <p>If <var>fr</var>’s <a data-link-type="dfn" href="#filereader-state" id="ref-for-filereader-state④">state</a> is not <code>"loading"</code>, <a data-link-type="dfn" href="#fire-a-progress-event" id="ref-for-fire-a-progress-event④">fire a progress event</a> called <code class="idl"><a data-link-type="idl" href="#dfn-loadend-event" id="ref-for-dfn-loadend-event">loadend</a></code> at the <var>fr</var>.</p>
          <p class="note" role="note"><span>Note:</span> Event handler for the <code class="idl"><a data-link-type="idl" href="#dfn-load-event" id="ref-for-dfn-load-event①">load</a></code> or <code class="idl"><a class="idl-code" data-link-type="event" href="#dfn-error-event" id="ref-for-dfn-error-event②">error</a></code> events could have started another load,
 if that happens the <code class="idl"><a data-link-type="idl" href="#dfn-loadend-event" id="ref-for-dfn-loadend-event①">loadend</a></code> event for this load is not fired.</p>
        </ol>
       <li data-md>
        <p>Otherwise, if <var>chunkPromise</var> is rejected with an error <var>error</var>, <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task" id="ref-for-queue-a-task④">queue a task</a> to run the following steps and abort this algorithm:</p>
        <ol>
         <li data-md>
          <p>Set <var>fr</var>’s <a data-link-type="dfn" href="#filereader-state" id="ref-for-filereader-state⑤">state</a> to <code>"done"</code>.</p>
         <li data-md>
          <p>Set <var>fr</var>’s <a data-link-type="dfn" href="#filereader-error" id="ref-for-filereader-error③">error</a> to <var>error</var>.</p>
         <li data-md>
          <p><a data-link-type="dfn" href="#fire-a-progress-event" id="ref-for-fire-a-progress-event⑤">Fire a progress event</a> called <code class="idl"><a class="idl-code" data-link-type="event" href="#dfn-error-event" id="ref-for-dfn-error-event③">error</a></code> at <var>fr</var>.</p>
         <li data-md>
          <p>If <var>fr</var>’s <a data-link-type="dfn" href="#filereader-state" id="ref-for-filereader-state⑥">state</a> is not <code>"loading"</code>, <a data-link-type="dfn" href="#fire-a-progress-event" id="ref-for-fire-a-progress-event⑥">fire a progress event</a> called <code class="idl"><a data-link-type="idl" href="#dfn-loadend-event" id="ref-for-dfn-loadend-event②">loadend</a></code> at <var>fr</var>.</p>
          <p class="note" role="note"><span>Note:</span> Event handler for the <code class="idl"><a class="idl-code" data-link-type="event" href="#dfn-error-event" id="ref-for-dfn-error-event④">error</a></code> event could have started another load,
 if that happens the <code class="idl"><a data-link-type="idl" href="#dfn-loadend-event" id="ref-for-dfn-loadend-event③">loadend</a></code> event for this load is not fired.</p>
        </ol>
      </ol>
    </ol>
    <p>Use the <a data-link-type="dfn" href="#fileReadingTaskSource" id="ref-for-fileReadingTaskSource">file reading task source</a> for all these tasks.</p>
   </div>
   <h4 class="heading settled" data-level="6.2.1" id="event-handler-attributes-section"><span class="secno">6.2.1. </span><span class="content">Event Handler Content Attributes</span><a class="self-link" href="#event-handler-attributes-section"></a></h4>
   <p>The following are the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-content-attributes" id="ref-for-event-handler-content-attributes">event handler content attributes</a> (and their corresponding <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type" id="ref-for-event-handler-event-type">event handler event types</a>)
that user agents must support on <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader①⓪">FileReader</a></code> as DOM attributes:</p>
   <table>
    <thead>
     <tr>
      <th><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-content-attributes" id="ref-for-event-handler-content-attributes①">event handler content attribute</a> 
      <th><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type" id="ref-for-event-handler-event-type①">event handler event type</a> 
    <tbody>
     <tr>
      <td><dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="attribute" data-export id="dfn-onloadstart"><code>onloadstart</code></dfn> 
      <td><code class="idl"><a data-link-type="idl" href="#dfn-loadstart-event" id="ref-for-dfn-loadstart-event②">loadstart</a></code> 
     <tr>
      <td><dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="attribute" data-export id="dfn-onprogress"><code>onprogress</code></dfn> 
      <td><code class="idl"><a data-link-type="idl" href="#dfn-progress-event" id="ref-for-dfn-progress-event①">progress</a></code> 
     <tr>
      <td><dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="attribute" data-export id="dfn-onabort"><code>onabort</code></dfn> 
      <td><code class="idl"><a data-link-type="idl" href="#dfn-abort-event" id="ref-for-dfn-abort-event">abort</a></code> 
     <tr>
      <td><dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="attribute" data-export id="dfn-onerror"><code>onerror</code></dfn> 
      <td><code class="idl"><a class="idl-code" data-link-type="event" href="#dfn-error-event" id="ref-for-dfn-error-event⑤">error</a></code> 
     <tr>
      <td><dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="attribute" data-export id="dfn-onload"><code>onload</code></dfn> 
      <td><code class="idl"><a data-link-type="idl" href="#dfn-load-event" id="ref-for-dfn-load-event②">load</a></code> 
     <tr>
      <td><dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="attribute" data-export id="dfn-onloadend"><code>onloadend</code></dfn> 
      <td><code class="idl"><a data-link-type="idl" href="#dfn-loadend-event" id="ref-for-dfn-loadend-event④">loadend</a></code> 
   </table>
   <h4 class="heading settled" data-level="6.2.2" id="blobreader-state"><span class="secno">6.2.2. </span><span class="content">FileReader States</span><a class="self-link" href="#blobreader-state"></a></h4>
   <div class="note domintro" role="note">
     The <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader①①">FileReader</a></code> object can be in one of 3 states.
The <code class="idl"><a data-link-type="idl" href="#dom-filereader-readystate" id="ref-for-dom-filereader-readystate①">readyState</a></code> attribute tells you in which state the object is: 
    <dl>
     <dt data-md><code class="idl"><a data-link-type="idl" href="#dom-filereader-empty" id="ref-for-dom-filereader-empty①">EMPTY</a></code> (numeric value 0)
     <dd data-md>
      <p>The <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader①②">FileReader</a></code> object has been constructed,
 and there are no pending reads.
 None of the <a data-link-type="dfn" href="#read-method" id="ref-for-read-method①">read methods</a> have been called.
 This is the default state of a newly minted <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader①③">FileReader</a></code> object,
 until one of the <a data-link-type="dfn" href="#read-method" id="ref-for-read-method②">read methods</a> have been called on it.</p>
     <dt data-md><code class="idl"><a data-link-type="idl" href="#dom-filereader-loading" id="ref-for-dom-filereader-loading①">LOADING</a></code> (numeric value 1)
     <dd data-md>
      <p>A <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file③①">File</a></code> or <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob④⓪">Blob</a></code> is being read.
 One of the <a data-link-type="dfn" href="#read-method" id="ref-for-read-method③">read methods</a> is being processed,
 and no error has occurred during the read.</p>
     <dt data-md><code class="idl"><a data-link-type="idl" href="#dom-filereader-done" id="ref-for-dom-filereader-done①">DONE</a></code> (numeric value 2)
     <dd data-md>
      <p>The entire <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file③②">File</a></code> or <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob④①">Blob</a></code> has been read into memory,
 OR a <a data-link-type="dfn" href="#file-error-read" id="ref-for-file-error-read②">file read error</a> occurred,
 OR the read was aborted using <code class="idl"><a data-link-type="idl" href="#dfn-abort" id="ref-for-dfn-abort②">abort()</a></code>.
 The <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader①④">FileReader</a></code> is no longer reading a <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file③③">File</a></code> or <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob④②">Blob</a></code>.
 If <code class="idl"><a data-link-type="idl" href="#dom-filereader-readystate" id="ref-for-dom-filereader-readystate②">readyState</a></code> is set to <code class="idl"><a data-link-type="idl" href="#dom-filereader-done" id="ref-for-dom-filereader-done②">DONE</a></code> it means at least one of the <a data-link-type="dfn" href="#read-method" id="ref-for-read-method④">read methods</a> have been called on this <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader①⑤">FileReader</a></code>.</p>
    </dl>
   </div>
   <h4 class="heading settled" data-level="6.2.3" id="reading-a-file"><span class="secno">6.2.3. </span><span class="content">Reading a File or Blob</span><a class="self-link" href="#reading-a-file"></a></h4>
   <p>The <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader①⑥">FileReader</a></code> interface makes available several <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="asynchronous read method" data-noexport id="asynchronous-read-methods">asynchronous read methods</dfn>—<wbr><code class="idl"><a data-link-type="idl" href="#dfn-readAsArrayBuffer" id="ref-for-dfn-readAsArrayBuffer①">readAsArrayBuffer()</a></code>, <code class="idl"><a data-link-type="idl" href="#dfn-readAsBinaryString" id="ref-for-dfn-readAsBinaryString①">readAsBinaryString()</a></code>, <code class="idl"><a data-link-type="idl" href="#dfn-readAsText" id="ref-for-dfn-readAsText②">readAsText()</a></code> and <code class="idl"><a data-link-type="idl" href="#dfn-readAsDataURL" id="ref-for-dfn-readAsDataURL①">readAsDataURL()</a></code>,
which read files into memory.</p>
   <p class="note" role="note"><span>Note:</span> If multiple concurrent read methods are called on the same <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader①⑦">FileReader</a></code> object,
user agents throw an <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#invalidstateerror" id="ref-for-invalidstateerror①">InvalidStateError</a></code> on any of the read methods that occur
when <code class="idl"><a data-link-type="idl" href="#dom-filereader-readystate" id="ref-for-dom-filereader-readystate③">readyState</a></code> = <code class="idl"><a data-link-type="idl" href="#dom-filereader-loading" id="ref-for-dom-filereader-loading②">LOADING</a></code>.</p>
   <p>(<code class="idl"><a data-link-type="idl" href="#dfn-FileReaderSync" id="ref-for-dfn-FileReaderSync②">FileReaderSync</a></code> makes available several <a data-link-type="dfn" href="#read-method-sync" id="ref-for-read-method-sync">synchronous read methods</a>.
  Collectively, the sync and async read methods of <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader①⑧">FileReader</a></code> and <code class="idl"><a data-link-type="idl" href="#dfn-FileReaderSync" id="ref-for-dfn-FileReaderSync③">FileReaderSync</a></code> are referred to as just <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="read method" data-noexport id="read-method">read methods</dfn>.)</p>
   <h5 class="heading settled" data-level="6.2.3.1" id="readAsDataURL"><span class="secno">6.2.3.1. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#dfn-readAsDataURL" id="ref-for-dfn-readAsDataURL②">readAsDataURL()</a></code> method</span><a class="self-link" href="#readAsDataURL"></a></h5>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="method" data-export id="dfn-readAsDataURL"><code>readAsDataURL(<var>blob</var>)</code></dfn> method,
when invoked, must initiate a <a data-link-type="dfn" href="#readOperation" id="ref-for-readOperation①">read operation</a> for <var>blob</var> with <em>DataURL</em>.</p>
   <h5 class="heading settled" data-level="6.2.3.2" id="readAsDataText"><span class="secno">6.2.3.2. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#dfn-readAsText" id="ref-for-dfn-readAsText③">readAsText()</a></code> method</span><a class="self-link" href="#readAsDataText"></a></h5>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="method" data-export data-lt="readAsText(blob, encoding)|readAsText(blob)" id="dfn-readAsText"><code>readAsText(<var>blob</var>, <var>encoding</var>)</code></dfn> method,
when invoked, must initiate a <a data-link-type="dfn" href="#readOperation" id="ref-for-readOperation②">read operation</a> for <var>blob</var> with <em>Text</em> and <var>encoding</var>.</p>
   <h5 class="heading settled" data-level="6.2.3.3" id="readAsArrayBuffer"><span class="secno">6.2.3.3. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#dfn-readAsArrayBuffer" id="ref-for-dfn-readAsArrayBuffer②">readAsArrayBuffer()</a></code></span><a class="self-link" href="#readAsArrayBuffer"></a></h5>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="method" data-export id="dfn-readAsArrayBuffer"><code>readAsArrayBuffer(<var>blob</var>)</code></dfn> method,
when invoked, must initiate a <a data-link-type="dfn" href="#readOperation" id="ref-for-readOperation③">read operation</a> for <var>blob</var> with <em>ArrayBuffer</em>.</p>
   <h5 class="heading settled" data-level="6.2.3.4" id="readAsBinaryString"><span class="secno">6.2.3.4. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#dfn-readAsBinaryString" id="ref-for-dfn-readAsBinaryString②">readAsBinaryString()</a></code> method</span><a class="self-link" href="#readAsBinaryString"></a></h5>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="method" data-export id="dfn-readAsBinaryString"><code>readAsBinaryString(<var>blob</var>)</code></dfn> method,
when invoked, must initiate a <a data-link-type="dfn" href="#readOperation" id="ref-for-readOperation④">read operation</a> for <var>blob</var> with <em>BinaryString</em>.</p>
   <p class="note" role="note"><span>Note:</span> The use of <code class="idl"><a data-link-type="idl" href="#dfn-readAsArrayBuffer" id="ref-for-dfn-readAsArrayBuffer③">readAsArrayBuffer()</a></code> is preferred over <code class="idl"><a data-link-type="idl" href="#dfn-readAsBinaryString" id="ref-for-dfn-readAsBinaryString③">readAsBinaryString()</a></code>, which is provided for backwards
compatibility.</p>
   <h5 class="heading settled" data-level="6.2.3.5" id="abort"><span class="secno">6.2.3.5. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#dfn-abort" id="ref-for-dfn-abort③">abort()</a></code> method</span><a class="self-link" href="#abort"></a></h5>
   <p>When the <dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="method" data-export id="dfn-abort"><code>abort()</code></dfn> method is called,
the user agent must run the steps below:</p>
   <ol>
    <li data-md>
     <p>If <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object⑦">context object</a>'s <a data-link-type="dfn" href="#filereader-state" id="ref-for-filereader-state⑦">state</a> is <code>"empty"</code> or if <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object⑧">context object</a>'s <a data-link-type="dfn" href="#filereader-state" id="ref-for-filereader-state⑧">state</a> is <code>"done"</code> set <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object⑨">context object</a>'s <a data-link-type="dfn" href="#filereader-result" id="ref-for-filereader-result③">result</a> to <code>null</code> and <a data-link-type="dfn" href="#terminate-an-algorithm" id="ref-for-terminate-an-algorithm">terminate this algorithm</a>.</p>
    <li data-md>
     <p>If <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①⓪">context object</a>'s <a data-link-type="dfn" href="#filereader-state" id="ref-for-filereader-state⑨">state</a> is <code>"loading"</code> set <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①①">context object</a>'s <a data-link-type="dfn" href="#filereader-state" id="ref-for-filereader-state①⓪">state</a> to <code>"done"</code> and set <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①②">context object</a>'s <a data-link-type="dfn" href="#filereader-result" id="ref-for-filereader-result④">result</a> to <code>null</code>.</p>
    <li data-md>
     <p>If there are any <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-task" id="ref-for-concept-task">tasks</a> from the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①③">context object</a> on the <a data-link-type="dfn" href="#fileReadingTaskSource" id="ref-for-fileReadingTaskSource①">file reading task source</a> in an affiliated <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task" id="ref-for-queue-a-task⑤">task queue</a>,
 then remove those <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-task" id="ref-for-concept-task①">tasks</a> from that task queue.</p>
    <li data-md>
     <p><a data-link-type="dfn" href="#terminate-an-algorithm" id="ref-for-terminate-an-algorithm①">Terminate the algorithm</a> for the <a data-link-type="dfn" href="#read-method" id="ref-for-read-method⑤">read method</a> being processed.</p>
    <li data-md>
     <p><a data-link-type="dfn" href="#fire-a-progress-event" id="ref-for-fire-a-progress-event⑦">Fire a progress event</a> called <code class="idl"><a data-link-type="idl" href="#dfn-abort-event" id="ref-for-dfn-abort-event①">abort</a></code> at the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①④">context object</a>.</p>
    <li data-md>
     <p>If <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①⑤">context object</a>'s <a data-link-type="dfn" href="#filereader-state" id="ref-for-filereader-state①①">state</a> is not <code>"loading"</code>, <a data-link-type="dfn" href="#fire-a-progress-event" id="ref-for-fire-a-progress-event⑧">fire a progress event</a> called <code class="idl"><a data-link-type="idl" href="#dfn-loadend-event" id="ref-for-dfn-loadend-event⑤">loadend</a></code> at the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①⑥">context object</a>.</p>
   </ol>
   <h3 class="heading settled" data-level="6.3" id="packaging-data"><span class="secno">6.3. </span><span class="content">Packaging data</span><a class="self-link" href="#packaging-data"></a></h3>
   <div class="algorithm" data-algorithm="package data">
     A <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob④③">Blob</a></code> has an associated <dfn class="dfn-paneled" data-dfn-for="Blob" data-dfn-type="dfn" data-noexport id="blob-package-data">package data</dfn> algorithm,
given <var>bytes</var>, a <var>type</var>, a optional <var>mimeType</var>, and a optional <var>encodingName</var>,
which switches on <var>type</var> and runs the associated steps: 
    <dl>
     <dt data-md>DataURL
     <dd data-md>
      <p>Return <var>bytes</var> as a DataURL <a data-link-type="biblio" href="#biblio-rfc2397">[RFC2397]</a> subject to the considerations below:</p>
      <ul>
       <li data-md>
        <p>Use <var>mimeType</var> as part of the Data URL if it is available
in keeping with the Data URL specification <a data-link-type="biblio" href="#biblio-rfc2397">[RFC2397]</a>.</p>
       <li data-md>
        <p>If <var>mimeType</var> is not available return a Data URL without a media-type. <a data-link-type="biblio" href="#biblio-rfc2397">[RFC2397]</a>.</p>
      </ul>
      <p class="issue" id="issue-f80bda5b"><a class="self-link" href="#issue-f80bda5b"></a> Better specify how the DataURL is generated. <a href="https://github.com/w3c/FileAPI/issues/104">&lt;https://github.com/w3c/FileAPI/issues/104></a></p>
     <dt data-md>Text
     <dd data-md>
      <ol>
       <li data-md>
        <p>Let <var>encoding</var> be failure.</p>
       <li data-md>
        <p>If the <var>encodingName</var> is present, set <var>encoding</var> to the result of <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#concept-encoding-get" id="ref-for-concept-encoding-get">getting an encoding</a> from <var>encodingName</var>.</p>
       <li data-md>
        <p>If <var>encoding</var> is failure, and <var>mimeType</var> is present:</p>
        <ol>
         <li data-md>
          <p>Let <var>type</var> be the result of <a data-link-type="dfn" href="https://mimesniff.spec.whatwg.org/#parse-a-mime-type" id="ref-for-parse-a-mime-type①">parse a MIME type</a> given <var>mimeType</var>.</p>
         <li data-md>
          <p>If <var>type</var> is not failure,
  set <var>encoding</var> to the result of <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#concept-encoding-get" id="ref-for-concept-encoding-get①">getting an encoding</a> from <var>type</var>’s <a data-link-type="dfn" href="https://mimesniff.spec.whatwg.org/#parameters" id="ref-for-parameters">parameters</a>[<code>"charset"</code>].</p>
          <div class="example" id="example-161c55fc"><a class="self-link" href="#example-161c55fc"></a> If <code>blob</code> has a <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type①⑤">type</a></code> attribute of <code>text/plain;charset=utf-8</code> then <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#concept-encoding-get" id="ref-for-concept-encoding-get②">getting an encoding</a> is run using <code>"utf-8"</code> as the label.
  Note that user agents must parse and extract the portion of the Charset Parameter
  that constitutes a <em>label</em> of an encoding. </div>
        </ol>
       <li data-md>
        <p>If <var>encoding</var> is failure, then set <var>encoding</var> to <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8" id="ref-for-utf-8">UTF-8</a>.</p>
       <li data-md>
        <p><a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#decode" id="ref-for-decode">Decode</a> <var>bytes</var> using fallback encoding <var>encoding</var>, and return the result.</p>
      </ol>
     <dt data-md>ArrayBuffer
     <dd data-md>
      <p>Return a new <code>ArrayBuffer</code> whose contents are <var>bytes</var>.</p>
     <dt data-md>BinaryString
     <dd data-md>
      <p>Return <var>bytes</var> as a binary string,
 in which every byte is represented by a code unit of equal value [0..255].</p>
    </dl>
   </div>
   <h3 class="heading settled" data-level="6.4" id="events"><span class="secno">6.4. </span><span class="content">Events</span><a class="self-link" href="#events"></a></h3>
   <p>The <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader①⑨">FileReader</a></code> object must be the event target for all events in this specification.</p>
   <p>When this specification says to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="fire-a-progress-event">fire a progress event</dfn> <i>called e</i> (for some <code class="idl"><a data-link-type="idl" href="https://xhr.spec.whatwg.org/#progressevent" id="ref-for-progressevent">ProgressEvent</a></code> <code>e</code> at a given <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader②⓪">FileReader</a></code> <code>reader</code> as the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①⑦">context object</a>),
the following are normative:</p>
   <ul>
    <li data-md>
     <p>The progress event <code>e</code> does not bubble. <code>e.bubbles</code> must be false <a data-link-type="biblio" href="#biblio-dom">[DOM]</a></p>
    <li data-md>
     <p>The progress event <code>e</code> is NOT cancelable. <code>e.cancelable</code> must be false <a data-link-type="biblio" href="#biblio-dom">[DOM]</a></p>
   </ul>
   <h4 class="heading settled" data-level="6.4.1" id="event-summary"><span class="secno">6.4.1. </span><span class="content">Event Summary</span><a class="self-link" href="#event-summary"></a></h4>
   <p>The following are the events that are <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire" id="ref-for-concept-event-fire">fired</a> at <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader②①">FileReader</a></code> objects.</p>
   <table id="event-summary-table">
    <thead>
     <tr>
      <th>Event name 
      <th>Interface 
      <th>Fired when… 
    <tbody>
     <tr>
      <td><dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="event" data-export id="dfn-loadstart-event"><code>loadstart</code></dfn> 
      <td><code class="idl"><a data-link-type="idl" href="https://xhr.spec.whatwg.org/#progressevent" id="ref-for-progressevent①">ProgressEvent</a></code> 
      <td>When the read starts. 
     <tr>
      <td><dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="event" data-export id="dfn-progress-event"><code>progress</code></dfn> 
      <td><code class="idl"><a data-link-type="idl" href="https://xhr.spec.whatwg.org/#progressevent" id="ref-for-progressevent②">ProgressEvent</a></code> 
      <td>While reading (and decoding) <code>blob</code> 
     <tr>
      <td><dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="event" data-export id="dfn-abort-event"><code>abort</code></dfn> 
      <td><code class="idl"><a data-link-type="idl" href="https://xhr.spec.whatwg.org/#progressevent" id="ref-for-progressevent③">ProgressEvent</a></code> 
      <td>When the read has been aborted.
        For instance, by invoking the <code class="idl"><a data-link-type="idl" href="#dfn-abort" id="ref-for-dfn-abort④">abort()</a></code> method. 
     <tr>
      <td><dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="event" data-export id="dfn-error-event"><code>error</code></dfn> 
      <td><code class="idl"><a data-link-type="idl" href="https://xhr.spec.whatwg.org/#progressevent" id="ref-for-progressevent④">ProgressEvent</a></code> 
      <td>When the read has failed (see <a data-link-type="dfn" href="#file-error-read" id="ref-for-file-error-read③">file read errors</a>). 
     <tr>
      <td><dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="event" data-export id="dfn-load-event"><code>load</code></dfn> 
      <td><code class="idl"><a data-link-type="idl" href="https://xhr.spec.whatwg.org/#progressevent" id="ref-for-progressevent⑤">ProgressEvent</a></code> 
      <td>When the read has successfully completed. 
     <tr>
      <td><dfn class="dfn-paneled idl-code" data-dfn-for="FileReader" data-dfn-type="event" data-export id="dfn-loadend-event"><code>loadend</code></dfn> 
      <td><code class="idl"><a data-link-type="idl" href="https://xhr.spec.whatwg.org/#progressevent" id="ref-for-progressevent⑥">ProgressEvent</a></code> 
      <td>When the request has completed (either in success or failure). 
   </table>
   <h4 class="heading settled" data-level="6.4.2" id="eventInvariants"><span class="secno">6.4.2. </span><span class="content">Summary of Event Invariants</span><a class="self-link" href="#eventInvariants"></a></h4>
   <p><em>This section is informative.</em></p>
   <p>The following are invariants applicable to <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire" id="ref-for-concept-event-fire①">event firing</a> for a given asynchronous <a data-link-type="dfn" href="#read-method" id="ref-for-read-method⑥">read method</a> in this specification:</p>
   <ol>
    <li data-md>
     <p>Once a <code class="idl"><a data-link-type="idl" href="#dfn-loadstart-event" id="ref-for-dfn-loadstart-event③">loadstart</a></code> has been fired,
a corresponding <code class="idl"><a data-link-type="idl" href="#dfn-loadend-event" id="ref-for-dfn-loadend-event⑥">loadend</a></code> fires at completion of the read,
UNLESS any of the following are true:</p>
     <ul>
      <li data-md>
       <p>the <a data-link-type="dfn" href="#read-method" id="ref-for-read-method⑦">read method</a> has been cancelled using <code class="idl"><a data-link-type="idl" href="#dfn-abort" id="ref-for-dfn-abort⑤">abort()</a></code> and a new <a data-link-type="dfn" href="#read-method" id="ref-for-read-method⑧">read method</a> has been invoked</p>
      <li data-md>
       <p>the event handler function for a <code class="idl"><a data-link-type="idl" href="#dfn-load-event" id="ref-for-dfn-load-event③">load</a></code> event initiates a new read</p>
      <li data-md>
       <p>the event handler function for a <code class="idl"><a class="idl-code" data-link-type="event" href="#dfn-error-event" id="ref-for-dfn-error-event⑥">error</a></code> event initiates a new read.</p>
     </ul>
     <p class="note" role="note"><span>Note:</span> The events <code class="idl"><a data-link-type="idl" href="#dfn-loadstart-event" id="ref-for-dfn-loadstart-event④">loadstart</a></code> and <code class="idl"><a data-link-type="idl" href="#dfn-loadend-event" id="ref-for-dfn-loadend-event⑦">loadend</a></code> are not coupled in a one-to-one manner.</p>
     <div class="example" id="example-4eee468a">
      <a class="self-link" href="#example-4eee468a"></a> This example showcases "read-chaining":
  initiating another read from within an event handler while the "first" read continues processing. 
<pre class="lang-javascript highlight"><c- c1>// In code of the sort...</c->
reader<c- p>.</c->readAsText<c- p>(</c->file<c- p>);</c->
reader<c- p>.</c->onload <c- o>=</c-> <c- a>function</c-><c- p>(){</c->reader<c- p>.</c->readAsText<c- p>(</c->alternateFile<c- p>);}</c->

<c- p>.....</c->

<c- c1>//... the loadend event must not fire for the first read</c->

reader<c- p>.</c->readAsText<c- p>(</c->file<c- p>);</c->
reader<c- p>.</c->abort<c- p>();</c->
reader<c- p>.</c->onabort <c- o>=</c-> <c- a>function</c-><c- p>(){</c->reader<c- p>.</c->readAsText<c- p>(</c->updatedFile<c- p>);}</c->

<c- c1>//... the loadend event must not fire for the first read</c->
</pre>
     </div>
    <li data-md>
     <p>One <code class="idl"><a data-link-type="idl" href="#dfn-progress-event" id="ref-for-dfn-progress-event②">progress</a></code> event will fire when <code>blob</code> has been completely read into memory.</p>
    <li data-md>
     <p>No <code class="idl"><a data-link-type="idl" href="#dfn-progress-event" id="ref-for-dfn-progress-event③">progress</a></code> event fires before <code class="idl"><a data-link-type="idl" href="#dfn-loadstart-event" id="ref-for-dfn-loadstart-event⑤">loadstart</a></code>.</p>
    <li data-md>
     <p>No <code class="idl"><a data-link-type="idl" href="#dfn-progress-event" id="ref-for-dfn-progress-event④">progress</a></code> event fires after any one of <code class="idl"><a data-link-type="idl" href="#dfn-abort-event" id="ref-for-dfn-abort-event②">abort</a></code>, <code class="idl"><a data-link-type="idl" href="#dfn-load-event" id="ref-for-dfn-load-event④">load</a></code>, and <code class="idl"><a class="idl-code" data-link-type="event" href="#dfn-error-event" id="ref-for-dfn-error-event⑦">error</a></code> have fired.
At most one of <code class="idl"><a data-link-type="idl" href="#dfn-abort-event" id="ref-for-dfn-abort-event③">abort</a></code>, <code class="idl"><a data-link-type="idl" href="#dfn-load-event" id="ref-for-dfn-load-event⑤">load</a></code>, and <code class="idl"><a class="idl-code" data-link-type="event" href="#dfn-error-event" id="ref-for-dfn-error-event⑧">error</a></code> fire for a given read.</p>
    <li data-md>
     <p>No <code class="idl"><a data-link-type="idl" href="#dfn-abort-event" id="ref-for-dfn-abort-event④">abort</a></code>, <code class="idl"><a data-link-type="idl" href="#dfn-load-event" id="ref-for-dfn-load-event⑥">load</a></code>, or <code class="idl"><a class="idl-code" data-link-type="event" href="#dfn-error-event" id="ref-for-dfn-error-event⑨">error</a></code> event fires after <code class="idl"><a data-link-type="idl" href="#dfn-loadend-event" id="ref-for-dfn-loadend-event⑧">loadend</a></code>.</p>
   </ol>
   <h3 class="heading settled" data-level="6.5" id="readingOnThreads"><span class="secno">6.5. </span><span class="content">Reading on Threads</span><a class="self-link" href="#readingOnThreads"></a></h3>
   <p>Web Workers allow for the use of synchronous <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file③④">File</a></code> or <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob④④">Blob</a></code> read APIs,
since such reads on threads do not block the main thread.
This section defines a synchronous API, which can be used within Workers [[Web Workers]].
Workers can avail of both the asynchronous API (the <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader②②">FileReader</a></code> object) <em>and</em> the synchronous API (the <code class="idl"><a data-link-type="idl" href="#dfn-FileReaderSync" id="ref-for-dfn-FileReaderSync④">FileReaderSync</a></code> object).</p>
   <h4 class="heading settled" data-level="6.5.1" id="FileReaderSync"><span class="secno">6.5.1. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#dfn-FileReaderSync" id="ref-for-dfn-FileReaderSync⑤">FileReaderSync</a></code> API</span><a class="self-link" href="#FileReaderSync"></a></h4>
   <p>This interface  provides methods to <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="synchronous read method" data-noexport id="read-method-sync">synchronously read</dfn> <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file③⑤">File</a></code> or <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob④⑤">Blob</a></code> objects into memory.</p>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed④"><c- g>Exposed</c-></a>=(<c- n>DedicatedWorker</c->,<c- n>SharedWorker</c->)]
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="dfn-FileReaderSync"><code><c- g>FileReaderSync</c-></code></dfn> {
  <dfn class="dfn-paneled idl-code" data-dfn-for="FileReaderSync" data-dfn-type="constructor" data-export data-lt="FileReaderSync()|constructor()" id="dom-filereadersync-filereadersync"><code><c- g>constructor</c-></code></dfn>();
  // Synchronously return strings

  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer④"><c- b>ArrayBuffer</c-></a> <a class="idl-code" data-link-type="method" href="#dfn-readAsArrayBufferSync" id="ref-for-dfn-readAsArrayBufferSync"><c- g>readAsArrayBuffer</c-></a>(<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob④⑥"><c- n>Blob</c-></a> <dfn class="idl-code" data-dfn-for="FileReaderSync/readAsArrayBuffer(blob)" data-dfn-type="argument" data-export id="dom-filereadersync-readasarraybuffer-blob-blob"><code><c- g>blob</c-></code><a class="self-link" href="#dom-filereadersync-readasarraybuffer-blob-blob"></a></dfn>);
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString⑨"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="method" href="#dfn-readAsBinaryStringSync" id="ref-for-dfn-readAsBinaryStringSync"><c- g>readAsBinaryString</c-></a>(<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob④⑦"><c- n>Blob</c-></a> <dfn class="idl-code" data-dfn-for="FileReaderSync/readAsBinaryString(blob)" data-dfn-type="argument" data-export id="dom-filereadersync-readasbinarystring-blob-blob"><code><c- g>blob</c-></code><a class="self-link" href="#dom-filereadersync-readasbinarystring-blob-blob"></a></dfn>);
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString①⓪"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="method" href="#dfn-readAsTextSync" id="ref-for-dfn-readAsTextSync"><c- g>readAsText</c-></a>(<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob④⑧"><c- n>Blob</c-></a> <dfn class="idl-code" data-dfn-for="FileReaderSync/readAsText(blob, encoding), FileReaderSync/readAsText(blob)" data-dfn-type="argument" data-export id="dom-filereadersync-readastext-blob-encoding-blob"><code><c- g>blob</c-></code><a class="self-link" href="#dom-filereadersync-readastext-blob-encoding-blob"></a></dfn>, <c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString①①"><c- b>DOMString</c-></a> <dfn class="idl-code" data-dfn-for="FileReaderSync/readAsText(blob, encoding), FileReaderSync/readAsText(blob)" data-dfn-type="argument" data-export id="dom-filereadersync-readastext-blob-encoding-encoding"><code><c- g>encoding</c-></code><a class="self-link" href="#dom-filereadersync-readastext-blob-encoding-encoding"></a></dfn>);
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString①②"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="method" href="#dfn-readAsDataURLSync" id="ref-for-dfn-readAsDataURLSync"><c- g>readAsDataURL</c-></a>(<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob④⑨"><c- n>Blob</c-></a> <dfn class="idl-code" data-dfn-for="FileReaderSync/readAsDataURL(blob)" data-dfn-type="argument" data-export id="dom-filereadersync-readasdataurl-blob-blob"><code><c- g>blob</c-></code><a class="self-link" href="#dom-filereadersync-readasdataurl-blob-blob"></a></dfn>);
};
</pre>
   <h5 class="heading settled" data-level="6.5.1.1" id="filereadersyncConstrctr"><span class="secno">6.5.1.1. </span><span class="content">Constructors</span><a class="self-link" href="#filereadersyncConstrctr"></a></h5>
   <p>When the <code class="idl"><a data-link-type="idl" href="#dom-filereadersync-filereadersync" id="ref-for-dom-filereadersync-filereadersync">FileReaderSync()</a></code> constructor is invoked,
the user agent must return a new <code class="idl"><a data-link-type="idl" href="#dfn-FileReaderSync" id="ref-for-dfn-FileReaderSync⑥">FileReaderSync</a></code> object.</p>
   <h5 class="heading settled" data-level="6.5.1.2" id="readAsTextSync"><span class="secno">6.5.1.2. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#dfn-readAsTextSync" id="ref-for-dfn-readAsTextSync①">readAsText()</a></code></span><a class="self-link" href="#readAsTextSync"></a></h5>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="FileReaderSync" data-dfn-type="method" data-export data-lt="readAsText(blob, encoding)|readAsText(blob)" id="dfn-readAsTextSync"><code>readAsText(<var>blob</var>, <var>encoding</var>)</code></dfn> method,
when invoked, must run these steps:</p>
   <ol>
    <li data-md>
     <p>Let <var>stream</var> be the result of calling <a data-link-type="dfn" href="#blob-get-stream" id="ref-for-blob-get-stream④">get stream</a> on <var>blob</var>.</p>
    <li data-md>
     <p>Let <var>reader</var> be the result of <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-get-reader" id="ref-for-concept-get-reader③">getting a reader</a> from <var>stream</var>.</p>
    <li data-md>
     <p>Let <var>promise</var> be the result of <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-read-all-bytes-from-readablestream" id="ref-for-concept-read-all-bytes-from-readablestream②">reading all bytes</a> from <var>stream</var> with <var>reader</var>.</p>
    <li data-md>
     <p>Wait for <var>promise</var> to be fulfilled or rejected.</p>
    <li data-md>
     <p>If <var>promise</var> fulfilled with a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence" id="ref-for-byte-sequence③">byte sequence</a> <var>bytes</var>:</p>
     <ol>
      <li data-md>
       <p>Return the result of <a data-link-type="dfn" href="#blob-package-data" id="ref-for-blob-package-data③">package data</a> given <var>bytes</var>, <em>Text</em>, <var>blob</var>’s <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type①⑥">type</a></code>, and <var>encoding</var>.</p>
     </ol>
    <li data-md>
     <p>Throw <var>promise</var>’s rejection reason.</p>
   </ol>
   <h5 class="heading settled" data-level="6.5.1.3" id="readAsDataURLSync-section"><span class="secno">6.5.1.3. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#dfn-readAsDataURLSync" id="ref-for-dfn-readAsDataURLSync①">readAsDataURL()</a></code> method</span><a class="self-link" href="#readAsDataURLSync-section"></a></h5>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="FileReaderSync" data-dfn-type="method" data-export id="dfn-readAsDataURLSync"><code>readAsDataURL(<var>blob</var>)</code></dfn> method,
when invoked, must run these steps:</p>
   <ol>
    <li data-md>
     <p>Let <var>stream</var> be the result of calling <a data-link-type="dfn" href="#blob-get-stream" id="ref-for-blob-get-stream⑤">get stream</a> on <var>blob</var>.</p>
    <li data-md>
     <p>Let <var>reader</var> be the result of <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-get-reader" id="ref-for-concept-get-reader④">getting a reader</a> from <var>stream</var>.</p>
    <li data-md>
     <p>Let <var>promise</var> be the result of <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-read-all-bytes-from-readablestream" id="ref-for-concept-read-all-bytes-from-readablestream③">reading all bytes</a> from <var>stream</var> with <var>reader</var>.</p>
    <li data-md>
     <p>Wait for <var>promise</var> to be fulfilled or rejected.</p>
    <li data-md>
     <p>If <var>promise</var> fulfilled with a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence" id="ref-for-byte-sequence④">byte sequence</a> <var>bytes</var>:</p>
     <ol>
      <li data-md>
       <p>Return the result of <a data-link-type="dfn" href="#blob-package-data" id="ref-for-blob-package-data④">package data</a> given <var>bytes</var>, <em>DataURL</em>, and <var>blob</var>’s <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type①⑦">type</a></code>.</p>
     </ol>
    <li data-md>
     <p>Throw <var>promise</var>’s rejection reason.</p>
   </ol>
   <h5 class="heading settled" data-level="6.5.1.4" id="readAsArrayBufferSyncSection"><span class="secno">6.5.1.4. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#dfn-readAsArrayBufferSync" id="ref-for-dfn-readAsArrayBufferSync①">readAsArrayBuffer()</a></code> method</span><a class="self-link" href="#readAsArrayBufferSyncSection"></a></h5>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="FileReaderSync" data-dfn-type="method" data-export id="dfn-readAsArrayBufferSync"><code>readAsArrayBuffer(<var>blob</var>)</code></dfn> method,
when invoked, must run these steps:</p>
   <ol>
    <li data-md>
     <p>Let <var>stream</var> be the result of calling <a data-link-type="dfn" href="#blob-get-stream" id="ref-for-blob-get-stream⑥">get stream</a> on <var>blob</var>.</p>
    <li data-md>
     <p>Let <var>reader</var> be the result of <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-get-reader" id="ref-for-concept-get-reader⑤">getting a reader</a> from <var>stream</var>.</p>
    <li data-md>
     <p>Let <var>promise</var> be the result of <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-read-all-bytes-from-readablestream" id="ref-for-concept-read-all-bytes-from-readablestream④">reading all bytes</a> from <var>stream</var> with <var>reader</var>.</p>
    <li data-md>
     <p>Wait for <var>promise</var> to be fulfilled or rejected.</p>
    <li data-md>
     <p>If <var>promise</var> fulfilled with a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence" id="ref-for-byte-sequence⑤">byte sequence</a> <var>bytes</var>:</p>
     <ol>
      <li data-md>
       <p>Return the result of <a data-link-type="dfn" href="#blob-package-data" id="ref-for-blob-package-data⑤">package data</a> given <var>bytes</var>, <em>ArrayBuffer</em>, and <var>blob</var>’s <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type①⑧">type</a></code>.</p>
     </ol>
    <li data-md>
     <p>Throw <var>promise</var>’s rejection reason.</p>
   </ol>
   <h5 class="heading settled" data-level="6.5.1.5" id="readAsBinaryStringSyncSection"><span class="secno">6.5.1.5. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#dfn-readAsBinaryStringSync" id="ref-for-dfn-readAsBinaryStringSync①">readAsBinaryString()</a></code> method</span><a class="self-link" href="#readAsBinaryStringSyncSection"></a></h5>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="FileReaderSync" data-dfn-type="method" data-export id="dfn-readAsBinaryStringSync"><code>readAsBinaryString(<var>blob</var>)</code></dfn> method,
when invoked, must run these steps:</p>
   <ol>
    <li data-md>
     <p>Let <var>stream</var> be the result of calling <a data-link-type="dfn" href="#blob-get-stream" id="ref-for-blob-get-stream⑦">get stream</a> on <var>blob</var>.</p>
    <li data-md>
     <p>Let <var>reader</var> be the result of <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-get-reader" id="ref-for-concept-get-reader⑥">getting a reader</a> from <var>stream</var>.</p>
    <li data-md>
     <p>Let <var>promise</var> be the result of <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-read-all-bytes-from-readablestream" id="ref-for-concept-read-all-bytes-from-readablestream⑤">reading all bytes</a> from <var>stream</var> with <var>reader</var>.</p>
    <li data-md>
     <p>Wait for <var>promise</var> to be fulfilled or rejected.</p>
    <li data-md>
     <p>If <var>promise</var> fulfilled with a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence" id="ref-for-byte-sequence⑥">byte sequence</a> <var>bytes</var>:</p>
     <ol>
      <li data-md>
       <p>Return the result of <a data-link-type="dfn" href="#blob-package-data" id="ref-for-blob-package-data⑥">package data</a> given <var>bytes</var>, <em>BinaryString</em>, and <var>blob</var>’s <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type①⑨">type</a></code>.</p>
     </ol>
    <li data-md>
     <p>Throw <var>promise</var>’s rejection reason.</p>
   </ol>
   <p class="note" role="note"><span>Note:</span> The use of <code class="idl"><a data-link-type="idl" href="#dfn-readAsArrayBufferSync" id="ref-for-dfn-readAsArrayBufferSync②">readAsArrayBuffer()</a></code> is preferred over <code class="idl"><a data-link-type="idl" href="#dfn-readAsBinaryStringSync" id="ref-for-dfn-readAsBinaryStringSync②">readAsBinaryString()</a></code>, which is provided for
backwards compatibility.</p>
   <h2 class="heading settled" data-level="7" id="ErrorAndException"><span class="secno">7. </span><span class="content">Errors and Exceptions</span><a class="self-link" href="#ErrorAndException"></a></h2>
   <p><dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="file read error" data-noexport id="file-error-read">File read errors</dfn> can occur when reading files from the underlying filesystem.
The list below of potential error conditions is <em>informative</em>.</p>
   <ul>
    <li data-md>
     <p>The <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file③⑥">File</a></code> or <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑤⓪">Blob</a></code> being accessed may not exist
at the time one of the <a data-link-type="dfn" href="#asynchronous-read-methods" id="ref-for-asynchronous-read-methods">asynchronous read methods</a> or <a data-link-type="dfn" href="#read-method-sync" id="ref-for-read-method-sync①">synchronous read methods</a> are called.
This may be due to it having been moved or deleted after a reference to it was acquired
(e.g. concurrent modification with another application).
See <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#notfounderror" id="ref-for-notfounderror②">NotFoundError</a></code>.</p>
    <li data-md>
     <p>A <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file③⑦">File</a></code> or <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑤①">Blob</a></code> may be unreadable.
This may be due to permission problems that occur after a reference to a <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file③⑧">File</a></code> or <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑤②">Blob</a></code> has been acquired
(e.g. concurrent lock with another application).
Additionally, the <a data-link-type="dfn" href="#snapshot-state" id="ref-for-snapshot-state⑨">snapshot state</a> may have changed.
See <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#notreadableerror" id="ref-for-notreadableerror">NotReadableError</a></code>.</p>
    <li data-md>
     <p>User agents MAY determine that some files are unsafe for use within Web applications.
A file may change on disk since the original file selection,
thus resulting in an invalid read.
Additionally, some file and directory structures may be considered restricted by the underlying filesystem;
attempts to read from them may be considered a security violation.
See <a href="#security-discussion">§ 9 Security and Privacy Considerations</a> and <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#securityerror" id="ref-for-securityerror">SecurityError</a></code>.</p>
   </ul>
   <h3 class="heading settled" data-level="7.1" id="dfn-error-codes"><span class="secno">7.1. </span><span class="content">Throwing an Exception or Returning an Error</span><a class="self-link" href="#dfn-error-codes"></a></h3>
   <p><em>This section is normative.</em></p>
   <p>Error conditions can arise when reading a <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file③⑨">File</a></code> or a <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑤③">Blob</a></code>.</p>
   <p>The <a data-link-type="dfn" href="#readOperation" id="ref-for-readOperation⑤">read operation</a> can terminate due to error conditions when reading a <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file④⓪">File</a></code> or a <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑤④">Blob</a></code>;
the particular error condition that causes the <a data-link-type="dfn" href="#blob-get-stream" id="ref-for-blob-get-stream⑧">get stream</a> algorithm to fail
is called a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="failureReason">failure reason</dfn>. A <a data-link-type="dfn" href="#failureReason" id="ref-for-failureReason①">failure reason</a> is one of <a data-link-type="dfn" href="#NotFoundFR" id="ref-for-NotFoundFR">NotFound</a>, <a data-link-type="dfn" href="#UnsafeFileFR" id="ref-for-UnsafeFileFR">UnsafeFile</a>, <a data-link-type="dfn" href="#TooManyReadsFR" id="ref-for-TooManyReadsFR">TooManyReads</a>, <a data-link-type="dfn" href="#SnapshotStateFR" id="ref-for-SnapshotStateFR">SnapshotState</a>, or <a data-link-type="dfn" href="#FileLockFR" id="ref-for-FileLockFR">FileLock</a>.</p>
   <p>Synchronous read methods <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-throw" id="ref-for-dfn-throw">throw</a> exceptions of the type in the table below
if there has been an error owing to a particular <a data-link-type="dfn" href="#failureReason" id="ref-for-failureReason②">failure reason</a>.</p>
   <p>Asynchronous read methods use the <code class="idl"><a class="idl-code" data-link-type="attribute" href="#dom-filereader-error" id="ref-for-dom-filereader-error②">error</a></code> attribute of the <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader②③">FileReader</a></code> object,
which must return a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#idl-DOMException" id="ref-for-idl-DOMException③">DOMException</a></code> object of the most appropriate type from the table below
if there has been an error owing to a particular <a data-link-type="dfn" href="#failureReason" id="ref-for-failureReason③">failure reason</a>,
or otherwise return null.</p>
   <table class="data">
    <thead>
     <tr>
      <th>Type 
      <th>Description and Failure Reason 
    <tbody>
     <tr>
      <td><code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#notfounderror" id="ref-for-notfounderror③">NotFoundError</a></code> 
      <td>
       If the <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file④①">File</a></code> or <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑤⑤">Blob</a></code> resource could not be found at the time the read was processed,
        this is the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="NotFoundFR">NotFound</dfn> <a data-link-type="dfn" href="#failureReason" id="ref-for-failureReason④">failure reason</a>. 
       <p>For asynchronous read methods the <code class="idl"><a class="idl-code" data-link-type="attribute" href="#dom-filereader-error" id="ref-for-dom-filereader-error③">error</a></code> attribute must return a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#notfounderror" id="ref-for-notfounderror④">NotFoundError</a></code> exception
        and synchronous read methods must <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-throw" id="ref-for-dfn-throw①">throw</a> a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#notfounderror" id="ref-for-notfounderror⑤">NotFoundError</a></code> exception.</p>
     <tr>
      <td><code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#securityerror" id="ref-for-securityerror①">SecurityError</a></code> 
      <td>
       If: 
       <ul>
        <li data-md>
         <p>it is determined that certain files are unsafe for access within a Web application, this is the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="UnsafeFileFR">UnsafeFile</dfn> <a data-link-type="dfn" href="#failureReason" id="ref-for-failureReason⑤">failure reason</a>.</p>
        <li data-md>
         <p>it is determined that too many read calls are being made on <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file④②">File</a></code> or <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑤⑥">Blob</a></code> resources, this is the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="TooManyReadsFR">TooManyReads</dfn> <a data-link-type="dfn" href="#failureReason" id="ref-for-failureReason⑥">failure reason</a>.</p>
       </ul>
       <p>For asynchronous read methods the <code class="idl"><a class="idl-code" data-link-type="attribute" href="#dom-filereader-error" id="ref-for-dom-filereader-error④">error</a></code> attribute may return a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#securityerror" id="ref-for-securityerror②">SecurityError</a></code> exception
        and synchronous read methods may <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-throw" id="ref-for-dfn-throw②">throw</a> a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#securityerror" id="ref-for-securityerror③">SecurityError</a></code> exception.</p>
       <p>This is a security error to be used in situations not covered by any other <a data-link-type="dfn" href="#failureReason" id="ref-for-failureReason⑦">failure reason</a>.</p>
     <tr>
      <td><code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#notreadableerror" id="ref-for-notreadableerror①">NotReadableError</a></code> 
      <td>
       If: 
       <ul>
        <li data-md>
         <p>the <a data-link-type="dfn" href="#snapshot-state" id="ref-for-snapshot-state①⓪">snapshot state</a> of a <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file④③">File</a></code> or a <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑤⑦">Blob</a></code> does not match the state of the underlying storage,
this is the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="SnapshotStateFR">SnapshotState</dfn> <a data-link-type="dfn" href="#failureReason" id="ref-for-failureReason⑧">failure reason</a>.</p>
        <li data-md>
         <p>the <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file④④">File</a></code> or <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑤⑧">Blob</a></code> cannot be read,
typically due due to permission problems that occur after a <a data-link-type="dfn" href="#snapshot-state" id="ref-for-snapshot-state①①">snapshot state</a> has been established
(e.g. concurrent lock on the underlying storage with another application)
then this is the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="FileLockFR">FileLock</dfn> <a data-link-type="dfn" href="#failureReason" id="ref-for-failureReason⑨">failure reason</a>.</p>
       </ul>
       <p>For asynchronous read methods the <code class="idl"><a class="idl-code" data-link-type="attribute" href="#dom-filereader-error" id="ref-for-dom-filereader-error⑤">error</a></code> attribute must return a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#notreadableerror" id="ref-for-notreadableerror②">NotReadableError</a></code> exception
        and synchronous read methods must <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-throw" id="ref-for-dfn-throw③">throw</a> a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#notreadableerror" id="ref-for-notreadableerror③">NotReadableError</a></code> exception.</p>
   </table>
   <h2 class="heading settled" data-level="8" id="url"><span class="secno">8. </span><span class="content">A URL for Blob and MediaSource reference</span><a class="self-link" href="#url"></a></h2>
   <p>This section defines a <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-scheme" id="ref-for-concept-url-scheme">scheme</a> for a <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url" id="ref-for-concept-url">URL</a> used to refer to <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑤⑨">Blob</a></code> and <code class="idl"><a data-link-type="idl" href="http://w3c.github.io/media-source/#mediasource" id="ref-for-mediasource">MediaSource</a></code> objects.</p>
   <h3 class="heading settled" data-level="8.1" id="url-intro"><span class="secno">8.1. </span><span class="content">Introduction</span><a class="self-link" href="#url-intro"></a></h3>
   <p><em>This section is informative.</em></p>
   <p><a data-link-type="dfn" href="#blob-url" id="ref-for-blob-url①">Blob (or object) URLs</a> are URLs like <code>blob:http://example.com/550e8400-e29b-41d4-a716-446655440000</code>.
This enables integration of <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑥⓪">Blob</a></code>s and <code class="idl"><a data-link-type="idl" href="http://w3c.github.io/media-source/#mediasource" id="ref-for-mediasource①">MediaSource</a></code>s with other
APIs that are only designed to be used with URLs, such as the <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element" id="ref-for-the-img-element">img</a></code> element. <a data-link-type="dfn" href="#blob-url" id="ref-for-blob-url②">Blob URLs</a> can also be used to navigate to as well as to trigger downloads
of locally generated data.</p>
   <p>For this purpose two static methods are exposed on the <code class="idl"><a data-link-type="idl" href="https://url.spec.whatwg.org/#url" id="ref-for-url">URL</a></code> interface, <code class="idl"><a data-link-type="idl" href="#dfn-createObjectURL" id="ref-for-dfn-createObjectURL">createObjectURL(obj)</a></code> and <code class="idl"><a data-link-type="idl" href="#dfn-revokeObjectURL" id="ref-for-dfn-revokeObjectURL">revokeObjectURL(url)</a></code>.
The first method creates a mapping from a <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url" id="ref-for-concept-url①">URL</a> to a <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑥①">Blob</a></code>,
and the second method revokes said mapping.
As long as the mapping exist the <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑥②">Blob</a></code> can’t be garbage collected,
so some care must be taken to revoke the URL as soon as the reference is no longer needed.
All URLs are revoked when the global that created the URL itself goes away.</p>
   <h3 class="heading settled" data-level="8.2" id="url-model"><span class="secno">8.2. </span><span class="content">Model</span><a class="self-link" href="#url-model"></a></h3>
   <p>Each user agent must maintain a <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="BlobURLStore">blob URL store</dfn>.
A <a data-link-type="dfn" href="#BlobURLStore" id="ref-for-BlobURLStore">blob URL store</a> is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ordered-map" id="ref-for-ordered-map">map</a> where <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-key" id="ref-for-map-key">keys</a> are <a data-link-type="dfn" href="https://url.spec.whatwg.org/#valid-url-string" id="ref-for-valid-url-string">valid URL strings</a> and <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-value" id="ref-for-map-value">values</a> are <a data-link-type="dfn" href="#blob-url-entry" id="ref-for-blob-url-entry">blob URL Entries</a>.</p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="blob-url-entry">blob URL entry</dfn> consists of
an <dfn data-dfn-for="blob URL entry" data-dfn-type="dfn" data-export id="blob-url-entry-object">object<a class="self-link" href="#blob-url-entry-object"></a></dfn> (of type <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑥③">Blob</a></code> or <code class="idl"><a data-link-type="idl" href="http://w3c.github.io/media-source/#mediasource" id="ref-for-mediasource②">MediaSource</a></code>),
and an <dfn class="dfn-paneled" data-dfn-for="blob URL entry" data-dfn-type="dfn" data-export id="blob-url-entry-environment">environment</dfn> (an <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object" id="ref-for-environment-settings-object">environment settings object</a>).</p>
   <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-key" id="ref-for-map-key①">Keys</a> in the <a data-link-type="dfn" href="#BlobURLStore" id="ref-for-BlobURLStore①">blob URL store</a> (also known as <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="blob URL|object URL" id="blob-url">blob URLs</dfn>)
are <a data-link-type="dfn" href="https://url.spec.whatwg.org/#valid-url-string" id="ref-for-valid-url-string①">valid URL strings</a> that when <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-parser" id="ref-for-concept-url-parser">parsed</a> result in a <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url" id="ref-for-concept-url②">URL</a> with a <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-scheme" id="ref-for-concept-url-scheme①">scheme</a> equal to "<code>blob</code>",
an <a data-link-type="dfn" href="https://url.spec.whatwg.org/#empty-host" id="ref-for-empty-host">empty host</a>, and a <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-path" id="ref-for-concept-url-path">path</a> consisting of one element itself also a <a data-link-type="dfn" href="https://url.spec.whatwg.org/#valid-url-string" id="ref-for-valid-url-string②">valid URL string</a>.</p>
   <div class="algorithm" data-algorithm="createBlobURL">
     To <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="generate a new blob URL|generating a new blob URL" data-noexport id="unicodeBlobURL"> generate a new blob URL</dfn>, run the following steps: 
    <ol>
     <li data-md>
      <p>Let <var>result</var> be the empty string.</p>
     <li data-md>
      <p>Append the string "<code>blob:</code>" to <var>result</var>.</p>
     <li data-md>
      <p>Let <var>settings</var> be the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#current-settings-object" id="ref-for-current-settings-object">current settings object</a></p>
     <li data-md>
      <p>Let <var>origin</var> be <var>settings</var>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin" id="ref-for-concept-settings-object-origin">origin</a>.</p>
     <li data-md>
      <p>Let <var>serialized</var> be the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#ascii-serialisation-of-an-origin" id="ref-for-ascii-serialisation-of-an-origin">ASCII serialization</a> of <var>origin</var>.</p>
     <li data-md>
      <p>If <var>serialized</var> is "<code>null</code>", set it to an implementation-defined value.</p>
     <li data-md>
      <p>Append <var>serialized</var> to <var>result</var>.</p>
     <li data-md>
      <p>Append U+0024 SOLIDUS (<code>/</code>) to <var>result</var>.</p>
     <li data-md>
      <p>Generate a UUID <a data-link-type="biblio" href="#biblio-rfc4122">[RFC4122]</a> as a string and append it to <var>result</var>.</p>
     <li data-md>
      <p>Return <var>result</var>.</p>
    </ol>
   </div>
   <div class="example" id="example-a7011cc8"><a class="self-link" href="#example-a7011cc8"></a> An example of a blob URL that can be generated by this algorithm is <code>blob:https://example.org/9115d58c-bcda-ff47-86e5-083e9a215304</code>1. </div>
   <div class="algorithm" data-algorithm="addBlobURL">
     To <dfn class="dfn-paneled" data-dfn-for="blob url store" data-dfn-type="dfn" data-lt="add an entry|add the entry|add an entry to the blob URL store|add the entry to the blob URL store|adding an entry to the blob URL store" data-noexport id="add-an-entry"> add an entry to the blob URL store</dfn> for a given <var>object</var>,
run the following steps: 
    <ol>
     <li data-md>
      <p>Let <var>store</var> be the user agent’s <a data-link-type="dfn" href="#BlobURLStore" id="ref-for-BlobURLStore②">blob URL store</a>.</p>
     <li data-md>
      <p>Let <var>url</var> be the result of <a data-link-type="dfn" href="#unicodeBlobURL" id="ref-for-unicodeBlobURL">generating a new blob URL</a>.</p>
     <li data-md>
      <p>Let <var>entry</var> be a new <a data-link-type="dfn" href="#blob-url-entry" id="ref-for-blob-url-entry①">blob URL entry</a> consisting of <var>object</var> and the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#current-settings-object" id="ref-for-current-settings-object①">current settings object</a>.</p>
     <li data-md>
      <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-set" id="ref-for-map-set">Set</a> <var>store</var>[<var>url</var>] to <var>entry</var>.</p>
     <li data-md>
      <p>Return <var>url</var>.</p>
    </ol>
   </div>
   <div class="algorithm" data-algorithm="removeBlobURL">
     To <dfn class="dfn-paneled" data-dfn-for="blob url store" data-dfn-type="dfn" data-lt="remove an entry|remove the entry|remove an entry from the blob URL store|remove the entry from the blob URL store" data-noexport id="removeTheEntry"> remove an entry from the blob URL store</dfn> for a given <var>url</var>,
run the following steps: 
    <ol>
     <li data-md>
      <p>Let <var>store</var> be the user agent’s <a data-link-type="dfn" href="#BlobURLStore" id="ref-for-BlobURLStore③">blob URL store</a>;</p>
     <li data-md>
      <p>Let <var>url string</var> be the result of <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-serializer" id="ref-for-concept-url-serializer">serializing</a> <var>url</var>.</p>
     <li data-md>
      <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-remove" id="ref-for-map-remove">Remove</a> <var>store</var>[<var>url string</var>].</p>
    </ol>
   </div>
   <h3 class="heading settled" data-level="8.3" id="requestResponseModel"><span class="secno">8.3. </span><span class="content">Dereferencing Model for blob URLs</span><a class="self-link" href="#requestResponseModel"></a></h3>
   <div class="algorithm" data-algorithm="resolveURL">
     To <dfn data-dfn-for="blob URL" data-dfn-type="dfn" data-export data-lt="resolve" id="blob-url-resolve">resolve a blob URL<a class="self-link" href="#blob-url-resolve"></a></dfn> given a <var>url</var> (a <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url" id="ref-for-concept-url③">URL</a>), run the following steps: 
    <ol>
     <li data-md>
      <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#assert" id="ref-for-assert">Assert</a>: <var>url</var>’s <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-scheme" id="ref-for-concept-url-scheme②">scheme</a> is "<code>blob</code>".</p>
     <li data-md>
      <p>Let <var>store</var> be the user agent’s <a data-link-type="dfn" href="#BlobURLStore" id="ref-for-BlobURLStore④">blob URL store</a>.</p>
     <li data-md>
      <p>Let <var>url string</var> be the result of <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-serializer" id="ref-for-concept-url-serializer①">serializing</a> <var>url</var> with the <em>exclude fragment flag</em> set.</p>
     <li data-md>
      <p>If <var>store</var>[<var>url string</var>] <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-exists" id="ref-for-map-exists">exists</a>, return <var>store</var>[<var>url string</var>]; otherwise return failure.</p>
    </ol>
   </div>
   <p>Futher requirements for the parsing and fetching model for <a data-link-type="dfn" href="#blob-url" id="ref-for-blob-url③">blob URLs</a> are defined in the <a data-link-type="biblio" href="#biblio-url">[URL]</a> and <a data-link-type="biblio" href="#biblio-fetch">[Fetch]</a> specifications.</p>
   <h4 class="heading settled" data-level="8.3.1" id="originOfBlobURL"><span class="secno">8.3.1. </span><span class="content">Origin of blob URLs</span><a class="self-link" href="#originOfBlobURL"></a></h4>
   <p><em>This section is informative.</em></p>
   <p>The origin of a blob URL is always the same as that of the environment that created the URL,
as long as the URL hasn’t been revoked yet. This is achieved by the <a data-link-type="biblio" href="#biblio-url">[URL]</a> spec looking up
the URL in the <a data-link-type="dfn" href="#BlobURLStore" id="ref-for-BlobURLStore⑤">blob URL store</a> when parsing a URL, and using that entry to return
the correct origin.</p>
   <p>If the URL was revoked the serialization of the origin will still remain the same
as the serialization of the origin of the environment that created the blob URL,
but for opaque origins the origin itself might be distinct. This difference isn’t
observable though, since a revoked blob URL can’t be resolved/fetched anymore anyway.</p>
   <h4 class="heading settled dfn-paneled" data-dfn-for="blob url" data-dfn-type="dfn" data-export data-level="8.3.2" data-lt="lifetime|lifetime stipulation" id="lifeTime"><span class="secno">8.3.2. </span><span class="content">Lifetime of blob URLs</span></h4>
   <p>This specification extends the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#unloading-document-cleanup-steps" id="ref-for-unloading-document-cleanup-steps">unloading document cleanup steps</a> with the following steps:</p>
   <ol>
    <li data-md>
     <p>Let <var>environment</var> be the <code class="idl"><a data-link-type="idl" href="https://dom.spec.whatwg.org/#document" id="ref-for-document">Document</a></code>'s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object" id="ref-for-relevant-settings-object">relevant settings object</a>.</p>
    <li data-md>
     <p>Let <var>store</var> be the user agent’s <a data-link-type="dfn" href="#BlobURLStore" id="ref-for-BlobURLStore⑥">blob URL store</a>;</p>
    <li data-md>
     <p>Remove from <var>store</var> any entries for which the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-value" id="ref-for-map-value①">value</a>'s <a data-link-type="dfn" href="#blob-url-entry-environment" id="ref-for-blob-url-entry-environment">environment</a> is equal to <var>environment</var>.</p>
   </ol>
   <p class="issue" id="issue-5f2e5a9d"><a class="self-link" href="#issue-5f2e5a9d"></a> This needs a similar hook when a worker is unloaded.</p>
   <h3 class="heading settled" data-level="8.4" id="creating-revoking"><span class="secno">8.4. </span><span class="content">Creating and Revoking a blob URL</span><a class="self-link" href="#creating-revoking"></a></h3>
   <p><a data-link-type="dfn" href="#blob-url" id="ref-for-blob-url④">Blob URLs</a> are created and revoked using static methods exposed on the <code class="idl"><a data-link-type="idl" href="https://url.spec.whatwg.org/#url" id="ref-for-url①">URL</a></code> object.
Revocation of a <a data-link-type="dfn" href="#blob-url" id="ref-for-blob-url⑤">blob URL</a> decouples the <a data-link-type="dfn" href="#blob-url" id="ref-for-blob-url⑥">blob URL</a> from the resource it refers to,
and if it is dereferenced after it is revoked,
user agents must act as if a <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-network-error" id="ref-for-concept-network-error">network error</a> has occurred.
This section describes a supplemental interface to the URL specification <a data-link-type="biblio" href="#biblio-url">[URL]</a> and presents methods for <a data-link-type="dfn" href="#blob-url" id="ref-for-blob-url⑦">blob URL</a> creation and revocation.</p>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed⑤"><c- g>Exposed</c-></a>=(<c- n>Window</c->,<c- n>DedicatedWorker</c->,<c- n>SharedWorker</c->)]
<c- b>partial</c-> <c- b>interface</c-> <a class="idl-code" data-link-type="interface" href="https://url.spec.whatwg.org/#url" id="ref-for-url②"><c- g>URL</c-></a> {
  <c- b>static</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString①③"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="method" href="#dfn-createObjectURL" id="ref-for-dfn-createObjectURL①"><c- g>createObjectURL</c-></a>((<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob⑥④"><c- n>Blob</c-></a> <c- b>or</c-> <a class="n" data-link-type="idl-name" href="http://w3c.github.io/media-source/#mediasource" id="ref-for-mediasource③"><c- n>MediaSource</c-></a>) <dfn class="idl-code" data-dfn-for="URL/createObjectURL(obj)" data-dfn-type="argument" data-export id="dom-url-createobjecturl-obj-obj"><code><c- g>obj</c-></code><a class="self-link" href="#dom-url-createobjecturl-obj-obj"></a></dfn>);
  <c- b>static</c-> <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dfn-revokeObjectURL" id="ref-for-dfn-revokeObjectURL①"><c- g>revokeObjectURL</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString①④"><c- b>DOMString</c-></a> <dfn class="idl-code" data-dfn-for="URL/revokeObjectURL(url)" data-dfn-type="argument" data-export id="dom-url-revokeobjecturl-url-url"><code><c- g>url</c-></code><a class="self-link" href="#dom-url-revokeobjecturl-url-url"></a></dfn>);
};
</pre>
   <div class="algorithm" data-algorithm="createObjectURL"> The <dfn class="dfn-paneled idl-code" data-dfn-for="URL" data-dfn-type="method" data-export id="dfn-createObjectURL"><code>createObjectURL(<var>obj</var>)</code></dfn> static method must
return the result of <a data-link-type="dfn" href="#add-an-entry" id="ref-for-add-an-entry">adding an entry to the blob URL store</a> for <var>obj</var>. </div>
   <div class="algorithm" data-algorithm="revokeObjectURL">
     The <dfn class="dfn-paneled idl-code" data-dfn-for="URL" data-dfn-type="method" data-export id="dfn-revokeObjectURL"><code>revokeObjectURL(<var>url</var>)</code></dfn> static method must run these steps: 
    <ol>
     <li data-md>
      <p>Let <var>url record</var> be the result of <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-parser" id="ref-for-concept-url-parser①">parsing</a> <var>url</var>.</p>
     <li data-md>
      <p>If <var>url record</var>’s <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-scheme" id="ref-for-concept-url-scheme③">scheme</a> is not "<code>blob</code>", return.</p>
     <li data-md>
      <p>Let <var>origin</var> be the <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-origin" id="ref-for-concept-url-origin">origin</a> of <var>url record</var>.</p>
     <li data-md>
      <p>Let <var>settings</var> be the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#current-settings-object" id="ref-for-current-settings-object②">current settings object</a>.</p>
     <li data-md>
      <p>If <var>origin</var> is not <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#same-origin" id="ref-for-same-origin">same origin</a> with <var>settings</var>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin" id="ref-for-concept-settings-object-origin①">origin</a>, return.</p>
     <li data-md>
      <p><a data-link-type="dfn" href="#removeTheEntry" id="ref-for-removeTheEntry">Remove an entry from the Blob URL Store</a> for <var>url</var>.</p>
    </ol>
    <p class="note" role="note"><span>Note:</span> This means that rather than throwing some kind of error, attempting to revoke a URL that isn’t registered will silently fail.
User agents might display a message on the error console if this happens.</p>
    <p class="note" role="note"><span>Note:</span> Attempts to dereference <var>url</var> after it has been revoked will result in a <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-network-error" id="ref-for-concept-network-error①">network error</a>.
Requests that were started before the <var>url</var> was revoked should still succeed.</p>
   </div>
   <div class="example" id="example-8201d564">
    <a class="self-link" href="#example-8201d564"></a> In the example below, <code>window1</code> and <code>window2</code> are separate,
  but in the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#same-origin" id="ref-for-same-origin①">same origin</a>; <code>window2</code> could be an <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element" id="ref-for-the-iframe-element">iframe</a></code> inside <code>window1</code>. 
<pre class="lang-javascript highlight">myurl <c- o>=</c-> window1<c- p>.</c->URL<c- p>.</c->createObjectURL<c- p>(</c->myblob<c- p>);</c->
window2<c- p>.</c->URL<c- p>.</c->revokeObjectURL<c- p>(</c->myurl<c- p>);</c->
</pre>
    <p>Since a user agent has one global <a data-link-type="dfn" href="#BlobURLStore" id="ref-for-BlobURLStore⑦">blob URL store</a>,
  it is possible to revoke an object URL from a different window than from which it was created.
  The <code>URL.<code class="idl"><a data-link-type="idl" href="#dfn-revokeObjectURL" id="ref-for-dfn-revokeObjectURL②">revokeObjectURL()</a></code></code> call
  ensures that subsequent dereferencing of <code>myurl</code> results in a the user agent acting as if a <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-network-error" id="ref-for-concept-network-error②">network error</a> has occurred.</p>
   </div>
   <h4 class="heading settled" data-level="8.4.1" id="examplesOfCreationRevocation"><span class="secno">8.4.1. </span><span class="content">Examples of blob URL Creation and Revocation</span><a class="self-link" href="#examplesOfCreationRevocation"></a></h4>
   <p><a data-link-type="dfn" href="#blob-url" id="ref-for-blob-url⑧">Blob URL</a>s are strings that are used to <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-fetch" id="ref-for-concept-fetch①">fetch</a> <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑥⑤">Blob</a></code> objects,
and can persist for as long as the <code>document</code> from which they were minted
using <code>URL.<code class="idl"><a data-link-type="idl" href="#dfn-createObjectURL" id="ref-for-dfn-createObjectURL②">createObjectURL()</a></code></code>—<wbr>see <a href="#lifeTime" id="ref-for-lifeTime">§ 8.3.2 Lifetime of blob URLs</a>.</p>
   <p>This section gives sample usage of creation and revocation of <a data-link-type="dfn" href="#blob-url" id="ref-for-blob-url⑨">blob URL</a>s with explanations.</p>
   <div class="example" id="example-1527a3d5">
    <a class="self-link" href="#example-1527a3d5"></a> In the example below, two <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element" id="ref-for-the-img-element①">img</a></code> elements <a data-link-type="biblio" href="#biblio-html">[HTML]</a> refer to the same <a data-link-type="dfn" href="#blob-url" id="ref-for-blob-url①⓪">blob URL</a>: 
<pre class="lang-javascript highlight">url <c- o>=</c-> URL<c- p>.</c->createObjectURL<c- p>(</c->blob<c- p>);</c->
img1<c- p>.</c->src <c- o>=</c-> url<c- p>;</c->
img2<c- p>.</c->src <c- o>=</c-> url<c- p>;</c->
</pre>
   </div>
   <div class="example" id="example-ec3131a7">
    <a class="self-link" href="#example-ec3131a7"></a> In the example below, <code>URL.<code class="idl"><a data-link-type="idl" href="#dfn-revokeObjectURL" id="ref-for-dfn-revokeObjectURL③">revokeObjectURL()</a></code></code> is explicitly called. 
<pre class="lang-javascript highlight"><c- a>var</c-> blobURLref <c- o>=</c-> URL<c- p>.</c->createObjectURL<c- p>(</c->file<c- p>);</c->
img1 <c- o>=</c-> <c- k>new</c-> Image<c- p>();</c->
img2 <c- o>=</c-> <c- k>new</c-> Image<c- p>();</c->

<c- c1>// Both assignments below work as expected</c->
img1<c- p>.</c->src <c- o>=</c-> blobURLref<c- p>;</c->
img2<c- p>.</c->src <c- o>=</c-> blobURLref<c- p>;</c->

<c- c1>// ... Following body load</c->
<c- c1>// Check if both images have loaded</c->
<c- k>if</c-><c- p>(</c->img1<c- p>.</c->complete <c- o>&amp;&amp;</c-> img2<c- p>.</c->complete<c- p>)</c-> <c- p>{</c->
  <c- c1>// Ensure that subsequent refs throw an exception</c->
  URL<c- p>.</c->revokeObjectURL<c- p>(</c->blobURLref<c- p>);</c->
<c- p>}</c-> <c- k>else</c-> <c- p>{</c->
  msg<c- p>(</c-><c- u>"Images cannot be previewed!"</c-><c- p>);</c->
  <c- c1>// revoke the string-based reference</c->
  URL<c- p>.</c->revokeObjectURL<c- p>(</c->blobURLref<c- p>);</c->
<c- p>}</c->
</pre>
   </div>
   <p>The example above allows multiple references to a single <a data-link-type="dfn" href="#blob-url" id="ref-for-blob-url①①">blob URL</a>,
and the web developer then revokes the <a data-link-type="dfn" href="#blob-url" id="ref-for-blob-url①②">blob URL</a> string after both image objects have been loaded.
While not restricting number of uses of the <a data-link-type="dfn" href="#blob-url" id="ref-for-blob-url①③">blob URL</a> offers more flexibility,
it increases the likelihood of leaks;
developers should pair it with a corresponding call to <code>URL.<code class="idl"><a data-link-type="idl" href="#dfn-revokeObjectURL" id="ref-for-dfn-revokeObjectURL④">revokeObjectURL()</a></code></code>.</p>
   <h2 class="heading settled" data-level="9" id="security-discussion"><span class="secno">9. </span><span class="content">Security and Privacy Considerations</span><a class="self-link" href="#security-discussion"></a></h2>
   <p><em>This section is informative.</em></p>
   <p>This specification allows web content to read files from the underlying file system,
as well as provides a means for files to be accessed by unique identifiers,
and as such is subject to some security considerations.
This specification also assumes that the primary user interaction is with the <code>&lt;input type="file"/></code> element of HTML forms <a data-link-type="biblio" href="#biblio-html">[HTML]</a>,
and that all files that are being read by <code class="idl"><a data-link-type="idl" href="#dfn-filereader" id="ref-for-dfn-filereader②④">FileReader</a></code> objects have first been selected by the user.
Important security considerations include preventing malicious file selection attacks (selection looping),
preventing access to system-sensitive files,
and guarding against modifications of files on disk after a selection has taken place.</p>
   <dl>
    <dt data-md>Preventing selection looping
    <dd data-md>
     <p>During file selection, a user may be bombarded with the file picker associated with <code>&lt;input type="file"/></code> (in a "must choose" loop that forces selection before the file picker is dismissed)
 and a user agent may prevent file access to any selections by making the <code class="idl"><a data-link-type="idl" href="#dfn-filelist" id="ref-for-dfn-filelist①②">FileList</a></code> object returned be of size 0.</p>
    <dt data-md>System-sensitive files
    <dd data-md>
     <p>(e.g. files in /usr/bin, password files, and other native operating system executables)
 typically should not be exposed to web content,
 and should not be accessed via <a data-link-type="dfn" href="#blob-url" id="ref-for-blob-url①④">blob URLs</a>.
 User agents may <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-throw" id="ref-for-dfn-throw④">throw</a> a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#securityerror" id="ref-for-securityerror④">SecurityError</a></code> exception for synchronous read methods,
 or return a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#securityerror" id="ref-for-securityerror⑤">SecurityError</a></code> exception for asynchronous reads.</p>
   </dl>
   <p class="issue" id="issue-61296551"><a class="self-link" href="#issue-61296551"></a> This section is provisional; more security data may supplement this in subsequent drafts.</p>
   <h2 class="heading settled" data-level="10" id="requirements"><span class="secno">10. </span><span class="content">Requirements and Use Cases</span><a class="self-link" href="#requirements"></a></h2>
   <p>This section covers what the requirements are for this API,
as well as illustrates some use cases.
This version of the API does not satisfy all use cases;
subsequent versions may elect to address these.</p>
   <ul>
    <li data-md>
     <p>Once a user has given permission,
user agents should provide the ability to read and parse data directly from a local file programmatically.</p>
     <div class="example" id="example-d8c3c684"><a class="self-link" href="#example-d8c3c684"></a> A lyrics viewer.
  User wants to read song lyrics from songs in his plist file.
  User browses for plist file.
  File is opened, read, parsed, and presented to the user as a sortable, actionable list within a web application.
  User can select songs to fetch lyrics.
  User uses the "browse for file" dialog. </div>
    <li data-md>
     <p>Data should be able to be stored locally so that it is available for later use,
which is useful for offline data access for web applications.</p>
     <div class="example" id="example-950bb00a"><a class="self-link" href="#example-950bb00a"></a> A Calendar App.
  User’s company has a calendar.
  User wants to sync local events to company calendar,
  marked as "busy" slots (without leaking personal info).
  User browses for file and selects it.
  The <code>text/calendar</code> file is parsed in the browser,
  allowing the user to merge the files to one calendar view.
  The user wants to then save the file back to his local calendar file (using "Save As"?).
  The user can also send the integrated calendar file back to the server calendar store asynchronously. </div>
    <li data-md>
     <p>User agents should provide the ability to save a local file programmatically given an amount of data and a file name.</p>
     <p class="note" role="note"><span>Note:</span> While this specification doesn’t provide an explicit API call to trigger downloads,
the HTML5 specification has addressed this.
The <code><a data-link-type="element-sub" href="https://svgwg.org/svg2-draft/linking.html#AElementDownloadAttribute" id="ref-for-AElementDownloadAttribute">download</a></code> attribute of the <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element" id="ref-for-the-a-element">a</a></code> element initiates a download,
saving a <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file④⑤">File</a></code> with the name specified.
The combination of this API and the <code><a data-link-type="element-sub" href="https://svgwg.org/svg2-draft/linking.html#AElementDownloadAttribute" id="ref-for-AElementDownloadAttribute①">download</a></code> attribute on <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element" id="ref-for-the-a-element①">a</a></code> elements
allows for the creation of files within web applications,
and the ability to save them locally.</p>
     <div class="example" id="example-eb79e741"><a class="self-link" href="#example-eb79e741"></a> A Spreadsheet App.
  User interacts with a form, and generates some input.
  The form then generates a CSV (Comma Separated Variables) output for the user to import into a spreadsheet,
  and uses "Save...".
  The generated output can also be directly integrated into a web-based spreadsheet,
  and uploaded asynchronously. </div>
    <li data-md>
     <p>User agents should provide a streamlined programmatic ability to send data from a file to a remote server
that works more efficiently than form-based uploads today.</p>
     <div class="example" id="example-5f8d4bd7"><a class="self-link" href="#example-5f8d4bd7"></a> A Video/Photo Upload App.
  User is able to select large files for upload,
  which can then be "chunk-transfered" to the server. </div>
    <li data-md>
     <p>User agents should provide an API exposed to script that exposes the features above.
The user is notified by UI anytime interaction with the file system takes place,
giving the user full ability to cancel or abort the transaction.
The user is notified of any file selections,
and can cancel these.
No invocations to these APIs occur silently without user intervention.</p>
   </ul>
   <h2 class="no-num heading settled" id="acknowledgements-section"><span class="content"> Acknowledgements</span><a class="self-link" href="#acknowledgements-section"></a></h2>
   <p>This specification was originally developed by the SVG Working Group. Many thanks to Mark Baker and Anne van Kesteren for their feedback.</p>
   <p>Thanks to Robin Berjon, Jonas Sicking and Vsevolod Shmyroff for editing the original specification.</p>
   <p>Special thanks to Olli Pettay, Nikunj Mehta, Garrett Smith, Aaron Boodman, Michael Nordman, Jian Li, Dmitry Titov, Ian Hickson, Darin Fisher, Sam Weinig, Adrian Bateman and Julian Reschke.</p>
   <p>Thanks to the W3C WebApps WG, and to participants on the public-webapps@w3.org listserv</p>
  </main>
  <div data-fill-with="conformance">
   <h2 class="no-ref no-num heading settled" id="conformance"><span class="content">Conformance</span><a class="self-link" href="#conformance"></a></h2>
   <h3 class="no-ref no-num heading settled" id="conventions"><span class="content">Document conventions</span><a class="self-link" href="#conventions"></a></h3>
   <p>Conformance requirements are expressed with a combination of
    descriptive assertions and RFC 2119 terminology. The key words “MUST”,
    “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
    “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this
    document are to be interpreted as described in RFC 2119.
    However, for readability, these words do not appear in all uppercase
    letters in this specification. </p>
   <p>All of the text of this specification is normative except sections
    explicitly marked as non-normative, examples, and notes. <a data-link-type="biblio" href="#biblio-rfc2119">[RFC2119]</a></p>
   <p>Examples in this specification are introduced with the words “for example”
    or are set apart from the normative text with <code>class="example"</code>,
    like this: </p>
   <div class="example" id="example-ae2b6bc0">
    <a class="self-link" href="#example-ae2b6bc0"></a> 
    <p>This is an example of an informative example.</p>
   </div>
   <p>Informative notes begin with the word “Note” and are set apart from the
    normative text with <code>class="note"</code>, like this: </p>
   <p class="note" role="note">Note, this is an informative note.</p>
   <h3 class="no-ref no-num heading settled" id="conformant-algorithms"><span class="content">Conformant Algorithms</span><a class="self-link" href="#conformant-algorithms"></a></h3>
   <p>Requirements phrased in the imperative as part of algorithms (such as
    "strip any leading space characters" or "return false and abort these
    steps") are to be interpreted with the meaning of the key word ("must",
    "should", "may", etc) used in introducing the algorithm.</p>
   <p>Conformance requirements phrased as algorithms or specific steps can be
    implemented in any manner, so long as the end result is equivalent. In
    particular, the algorithms defined in this specification are intended to
    be easy to understand and are not intended to be performant. Implementers
    are encouraged to optimize.</p>
  </div>
  <p id="back-to-top" role="navigation"><a href="#toc"><abbr title="Back to top">↑</abbr></a></p>
  . 
<script src="https://www.w3.org/scripts/TR/2016/fixup.js"></script>
  <h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2>
  <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3>
  <ul class="index">
   <li><a href="#dfn-abort">abort()</a><span>, in §6.2.3.5</span>
   <li><a href="#dfn-abort-event">abort</a><span>, in §6.4.1</span>
   <li><a href="#add-an-entry">add an entry</a><span>, in §8.2</span>
   <li><a href="#add-an-entry">add an entry to the blob URL store</a><span>, in §8.2</span>
   <li><a href="#add-an-entry">adding an entry to the blob URL store</a><span>, in §8.2</span>
   <li><a href="#add-an-entry">add the entry</a><span>, in §8.2</span>
   <li><a href="#add-an-entry">add the entry to the blob URL store</a><span>, in §8.2</span>
   <li><a href="#dom-blob-arraybuffer">arrayBuffer()</a><span>, in §3.3.4</span>
   <li><a href="#asynchronous-read-methods">asynchronous read method</a><span>, in §6.2.3</span>
   <li><a href="#dom-blob-blob">Blob()</a><span>, in §3</span>
   <li><a href="#dfn-Blob">Blob</a><span>, in §3</span>
   <li><a href="#dom-blob-blob">Blob(blobParts)</a><span>, in §3</span>
   <li><a href="#dom-blob-blob">Blob(blobParts, options)</a><span>, in §3</span>
   <li><a href="#typedefdef-blobpart">BlobPart</a><span>, in §3</span>
   <li><a href="#dfn-BlobPropertyBag">BlobPropertyBag</a><span>, in §3</span>
   <li><a href="#blob-url">blob URL</a><span>, in §8.2</span>
   <li><a href="#blob-url-entry">blob URL entry</a><span>, in §8.2</span>
   <li><a href="#BlobURLStore">blob URL store</a><span>, in §8.2</span>
   <li>
    constructor()
    <ul>
     <li><a href="#dom-blob-blob">constructor for Blob</a><span>, in §3</span>
     <li><a href="#filereaderConstrctr">constructor for FileReader</a><span>, in §6.2</span>
     <li><a href="#dom-filereadersync-filereadersync">constructor for FileReaderSync</a><span>, in §6.5.1</span>
    </ul>
   <li><a href="#dom-blob-blob">constructor(blobParts)</a><span>, in §3</span>
   <li><a href="#dom-blob-blob">constructor(blobParts, options)</a><span>, in §3</span>
   <li><a href="#dom-file-file">constructor(fileBits, fileName)</a><span>, in §4</span>
   <li><a href="#dom-file-file">constructor(fileBits, fileName, options)</a><span>, in §4</span>
   <li><a href="#convert-line-endings-to-native">converting line endings to native</a><span>, in §3.1.1</span>
   <li><a href="#convert-line-endings-to-native">convert line endings to native</a><span>, in §3.1.1</span>
   <li><a href="#dfn-createObjectURL">createObjectURL(obj)</a><span>, in §8.4</span>
   <li><a href="#dom-filereader-done">DONE</a><span>, in §6.2</span>
   <li><a href="#dom-filereader-empty">EMPTY</a><span>, in §6.2</span>
   <li><a href="#dom-blobpropertybag-endings">endings</a><span>, in §3.1.1</span>
   <li><a href="#enumdef-endingtype">EndingType</a><span>, in §3</span>
   <li><a href="#blob-url-entry-environment">environment</a><span>, in §8.2</span>
   <li>
    error
    <ul>
     <li><a href="#dom-filereader-error">attribute for FileReader</a><span>, in §6.2</span>
     <li><a href="#filereader-error">dfn for FileReader</a><span>, in §6.2</span>
     <li><a href="#dfn-error-event">event for FileReader</a><span>, in §6.4.1</span>
    </ul>
   <li><a href="#failureReason">failure reason</a><span>, in §7.1</span>
   <li><a href="#dfn-file">File</a><span>, in §4</span>
   <li><a href="#dom-file-file">File(fileBits, fileName)</a><span>, in §4</span>
   <li><a href="#dom-file-file">File(fileBits, fileName, options)</a><span>, in §4</span>
   <li><a href="#dfn-filelist">FileList</a><span>, in §5</span>
   <li><a href="#FileLockFR">FileLock</a><span>, in §7.1</span>
   <li><a href="#dfn-FilePropertyBag">FilePropertyBag</a><span>, in §4</span>
   <li><a href="#filereaderConstrctr">FileReader()</a><span>, in §6.2</span>
   <li><a href="#dfn-filereader">FileReader</a><span>, in §6.2</span>
   <li><a href="#file-error-read">file read error</a><span>, in §7</span>
   <li><a href="#dom-filereadersync-filereadersync">FileReaderSync()</a><span>, in §6.5.1</span>
   <li><a href="#dfn-FileReaderSync">FileReaderSync</a><span>, in §6.5.1</span>
   <li><a href="#fileReadingTaskSource">file reading task source</a><span>, in §6.1</span>
   <li><a href="#file-type-guidelines">file type guidelines</a><span>, in §4</span>
   <li><a href="#fire-a-progress-event">fire a progress event</a><span>, in §6.4</span>
   <li><a href="#unicodeBlobURL">generate a new blob URL</a><span>, in §8.2</span>
   <li><a href="#unicodeBlobURL">generating a new blob URL</a><span>, in §8.2</span>
   <li><a href="#blob-get-stream">get stream</a><span>, in §3</span>
   <li><a href="#dfn-item">item(index)</a><span>, in §5.2</span>
   <li>
    lastModified
    <ul>
     <li><a href="#dfn-lastModified">attribute for File</a><span>, in §4.2</span>
     <li><a href="#dfn-FPdate">dict-member for FilePropertyBag</a><span>, in §4.1.1</span>
    </ul>
   <li><a href="#dfn-length">length</a><span>, in §5.1</span>
   <li><a href="#lifeTime">lifetime</a><span>, in §8.3.1</span>
   <li><a href="#lifeTime">lifetime stipulation</a><span>, in §8.3.1</span>
   <li><a href="#dfn-load-event">load</a><span>, in §6.4.1</span>
   <li><a href="#dfn-loadend-event">loadend</a><span>, in §6.4.1</span>
   <li><a href="#dom-filereader-loading">LOADING</a><span>, in §6.2</span>
   <li><a href="#dfn-loadstart-event">loadstart</a><span>, in §6.4.1</span>
   <li><a href="#dfn-name">name</a><span>, in §4.2</span>
   <li><a href="#dom-endingtype-native">"native"</a><span>, in §3</span>
   <li><a href="#NotFoundFR">NotFound</a><span>, in §7.1</span>
   <li><a href="#blob-url-entry-object">object</a><span>, in §8.2</span>
   <li><a href="#blob-url">object URL</a><span>, in §8.2</span>
   <li><a href="#dfn-onabort">onabort</a><span>, in §6.2.1</span>
   <li><a href="#dfn-onerror">onerror</a><span>, in §6.2.1</span>
   <li><a href="#dfn-onload">onload</a><span>, in §6.2.1</span>
   <li><a href="#dfn-onloadend">onloadend</a><span>, in §6.2.1</span>
   <li><a href="#dfn-onloadstart">onloadstart</a><span>, in §6.2.1</span>
   <li><a href="#dfn-onprogress">onprogress</a><span>, in §6.2.1</span>
   <li><a href="#blob-package-data">package data</a><span>, in §6.3</span>
   <li><a href="#process-blob-parts">process blob parts</a><span>, in §3.1.1</span>
   <li><a href="#process-blob-parts">processing blob parts</a><span>, in §3.1.1</span>
   <li><a href="#dfn-progress-event">progress</a><span>, in §6.4.1</span>
   <li>
    readAsArrayBuffer(blob)
    <ul>
     <li><a href="#dfn-readAsArrayBuffer">method for FileReader</a><span>, in §6.2.3.3</span>
     <li><a href="#dfn-readAsArrayBufferSync">method for FileReaderSync</a><span>, in §6.5.1.4</span>
    </ul>
   <li>
    readAsBinaryString(blob)
    <ul>
     <li><a href="#dfn-readAsBinaryString">method for FileReader</a><span>, in §6.2.3.4</span>
     <li><a href="#dfn-readAsBinaryStringSync">method for FileReaderSync</a><span>, in §6.5.1.5</span>
    </ul>
   <li>
    readAsDataURL(blob)
    <ul>
     <li><a href="#dfn-readAsDataURL">method for FileReader</a><span>, in §6.2.3.1</span>
     <li><a href="#dfn-readAsDataURLSync">method for FileReaderSync</a><span>, in §6.5.1.3</span>
    </ul>
   <li>
    readAsText(blob)
    <ul>
     <li><a href="#dfn-readAsText">method for FileReader</a><span>, in §6.2.3.2</span>
     <li><a href="#dfn-readAsTextSync">method for FileReaderSync</a><span>, in §6.5.1.2</span>
    </ul>
   <li>
    readAsText(blob, encoding)
    <ul>
     <li><a href="#dfn-readAsText">method for FileReader</a><span>, in §6.2.3.2</span>
     <li><a href="#dfn-readAsTextSync">method for FileReaderSync</a><span>, in §6.5.1.2</span>
    </ul>
   <li><a href="#read-method">read method</a><span>, in §6.2.3</span>
   <li><a href="#readOperation">read operation</a><span>, in §6.2</span>
   <li><a href="#dom-filereader-readystate">readyState</a><span>, in §6.2</span>
   <li><a href="#removeTheEntry">remove an entry</a><span>, in §8.2</span>
   <li><a href="#removeTheEntry">remove an entry from the blob URL store</a><span>, in §8.2</span>
   <li><a href="#removeTheEntry">remove the entry</a><span>, in §8.2</span>
   <li><a href="#removeTheEntry">remove the entry from the blob URL store</a><span>, in §8.2</span>
   <li><a href="#blob-url-resolve">resolve</a><span>, in §8.3</span>
   <li>
    result
    <ul>
     <li><a href="#dom-filereader-result">attribute for FileReader</a><span>, in §6.2</span>
     <li><a href="#filereader-result">dfn for FileReader</a><span>, in §6.2</span>
    </ul>
   <li><a href="#dfn-revokeObjectURL">revokeObjectURL(url)</a><span>, in §8.4</span>
   <li><a href="#dfn-size">size</a><span>, in §3.2</span>
   <li><a href="#dfn-slice">slice()</a><span>, in §3.3.1</span>
   <li><a href="#dfn-slice">slice(start)</a><span>, in §3.3.1</span>
   <li><a href="#dfn-slice">slice(start, end)</a><span>, in §3.3.1</span>
   <li><a href="#dfn-slice">slice(start, end, contentType)</a><span>, in §3.3.1</span>
   <li><a href="#dfn-slice">slice(start, end, contentType), slice(start, end), slice(start), slice()</a><span>, in §3.3.1</span>
   <li><a href="#snapshot-state">snapshot state</a><span>, in §3</span>
   <li><a href="#SnapshotStateFR">SnapshotState</a><span>, in §7.1</span>
   <li><a href="#filereader-state">state</a><span>, in §6.2</span>
   <li><a href="#dom-blob-stream">stream()</a><span>, in §3.3.2</span>
   <li><a href="#read-method-sync">synchronous read method</a><span>, in §6.5.1</span>
   <li><a href="#terminate-an-algorithm">terminate an algorithm</a><span>, in §2</span>
   <li><a href="#terminate-an-algorithm">terminate this algorithm</a><span>, in §2</span>
   <li><a href="#dom-blob-text">text()</a><span>, in §3.3.3</span>
   <li><a href="#TooManyReadsFR">TooManyReads</a><span>, in §7.1</span>
   <li><a href="#dom-endingtype-transparent">"transparent"</a><span>, in §3</span>
   <li>
    type
    <ul>
     <li><a href="#dfn-type">attribute for Blob</a><span>, in §3.2</span>
     <li><a href="#dfn-BPtype">dict-member for BlobPropertyBag</a><span>, in §3.1.1</span>
    </ul>
   <li><a href="#UnixEpoch">Unix Epoch</a><span>, in §2</span>
   <li><a href="#UnsafeFileFR">UnsafeFile</a><span>, in §7.1</span>
  </ul>
  <aside class="dfn-panel" data-for="term-for-document">
   <a href="https://dom.spec.whatwg.org/#document">https://dom.spec.whatwg.org/#document</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-document">8.3.2. Lifetime of blob URLs</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-eventtarget">
   <a href="https://dom.spec.whatwg.org/#eventtarget">https://dom.spec.whatwg.org/#eventtarget</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-eventtarget">6.2. The FileReader API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-context-object">
   <a href="https://dom.spec.whatwg.org/#context-object">https://dom.spec.whatwg.org/#context-object</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-context-object">3.3.1. The slice() method</a>
    <li><a href="#ref-for-context-object①">3.3.2. The stream() method</a>
    <li><a href="#ref-for-context-object②">3.3.3. The text() method</a>
    <li><a href="#ref-for-context-object③">3.3.4. The arrayBuffer() method</a>
    <li><a href="#ref-for-context-object④">6.2. The FileReader API</a> <a href="#ref-for-context-object⑤">(2)</a> <a href="#ref-for-context-object⑥">(3)</a>
    <li><a href="#ref-for-context-object⑦">6.2.3.5. The abort() method</a> <a href="#ref-for-context-object⑧">(2)</a> <a href="#ref-for-context-object⑨">(3)</a> <a href="#ref-for-context-object①⓪">(4)</a> <a href="#ref-for-context-object①①">(5)</a> <a href="#ref-for-context-object①②">(6)</a> <a href="#ref-for-context-object①③">(7)</a> <a href="#ref-for-context-object①④">(8)</a> <a href="#ref-for-context-object①⑤">(9)</a> <a href="#ref-for-context-object①⑥">(10)</a>
    <li><a href="#ref-for-context-object①⑦">6.4. Events</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-event-fire">
   <a href="https://dom.spec.whatwg.org/#concept-event-fire">https://dom.spec.whatwg.org/#concept-event-fire</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-event-fire">6.4.1. Event Summary</a>
    <li><a href="#ref-for-concept-event-fire①">6.4.2. Summary of Event Invariants</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-sec-array-constructor">
   <a href="http://tc39.github.io/ecma262/#sec-array-constructor">http://tc39.github.io/ecma262/#sec-array-constructor</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sec-array-constructor">5. The FileList Interface</a> <a href="#ref-for-sec-array-constructor①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-sec-date-constructor">
   <a href="http://tc39.github.io/ecma262/#sec-date-constructor">http://tc39.github.io/ecma262/#sec-date-constructor</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sec-date-constructor">4.1. Constructor</a> <a href="#ref-for-sec-date-constructor①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-decode">
   <a href="https://encoding.spec.whatwg.org/#decode">https://encoding.spec.whatwg.org/#decode</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-decode">6.3. Packaging data</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-encoding-get">
   <a href="https://encoding.spec.whatwg.org/#concept-encoding-get">https://encoding.spec.whatwg.org/#concept-encoding-get</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-encoding-get">6.3. Packaging data</a> <a href="#ref-for-concept-encoding-get①">(2)</a> <a href="#ref-for-concept-encoding-get②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-utf-8">
   <a href="https://encoding.spec.whatwg.org/#utf-8">https://encoding.spec.whatwg.org/#utf-8</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-utf-8">6.3. Packaging data</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-utf-8-decode">
   <a href="https://encoding.spec.whatwg.org/#utf-8-decode">https://encoding.spec.whatwg.org/#utf-8-decode</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-utf-8-decode">3.3.3. The text() method</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-utf-8-encode">
   <a href="https://encoding.spec.whatwg.org/#utf-8-encode">https://encoding.spec.whatwg.org/#utf-8-encode</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-utf-8-encode">3.1.1. Constructor Parameters</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-readablestream">
   <a href="https://fetch.spec.whatwg.org/#concept-readablestream">https://fetch.spec.whatwg.org/#concept-readablestream</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-readablestream">3. The Blob Interface and Binary Data</a> <a href="#ref-for-concept-readablestream①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-construct-readablestream">
   <a href="https://fetch.spec.whatwg.org/#concept-construct-readablestream">https://fetch.spec.whatwg.org/#concept-construct-readablestream</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-construct-readablestream">3. The Blob Interface and Binary Data</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-enqueue-readablestream">
   <a href="https://fetch.spec.whatwg.org/#concept-enqueue-readablestream">https://fetch.spec.whatwg.org/#concept-enqueue-readablestream</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-enqueue-readablestream">3. The Blob Interface and Binary Data</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-error-readablestream">
   <a href="https://fetch.spec.whatwg.org/#concept-error-readablestream">https://fetch.spec.whatwg.org/#concept-error-readablestream</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-error-readablestream">3. The Blob Interface and Binary Data</a> <a href="#ref-for-concept-error-readablestream①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-fetch">
   <a href="https://fetch.spec.whatwg.org/#concept-fetch">https://fetch.spec.whatwg.org/#concept-fetch</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-fetch">3.2. Attributes</a>
    <li><a href="#ref-for-concept-fetch①">8.4.1. Examples of blob URL Creation and Revocation</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-get-reader">
   <a href="https://fetch.spec.whatwg.org/#concept-get-reader">https://fetch.spec.whatwg.org/#concept-get-reader</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-get-reader">3.3.3. The text() method</a>
    <li><a href="#ref-for-concept-get-reader①">3.3.4. The arrayBuffer() method</a>
    <li><a href="#ref-for-concept-get-reader②">6.2. The FileReader API</a>
    <li><a href="#ref-for-concept-get-reader③">6.5.1.2. The readAsText()</a>
    <li><a href="#ref-for-concept-get-reader④">6.5.1.3. The readAsDataURL() method</a>
    <li><a href="#ref-for-concept-get-reader⑤">6.5.1.4. The readAsArrayBuffer() method</a>
    <li><a href="#ref-for-concept-get-reader⑥">6.5.1.5. The readAsBinaryString() method</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-network-error">
   <a href="https://fetch.spec.whatwg.org/#concept-network-error">https://fetch.spec.whatwg.org/#concept-network-error</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-network-error">8.4. Creating and Revoking a blob URL</a> <a href="#ref-for-concept-network-error①">(2)</a> <a href="#ref-for-concept-network-error②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-read-chunk-from-readablestream">
   <a href="https://fetch.spec.whatwg.org/#concept-read-chunk-from-readablestream">https://fetch.spec.whatwg.org/#concept-read-chunk-from-readablestream</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-read-chunk-from-readablestream">6.2. The FileReader API</a> <a href="#ref-for-concept-read-chunk-from-readablestream①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-read-all-bytes-from-readablestream">
   <a href="https://fetch.spec.whatwg.org/#concept-read-all-bytes-from-readablestream">https://fetch.spec.whatwg.org/#concept-read-all-bytes-from-readablestream</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-read-all-bytes-from-readablestream">3.3.3. The text() method</a>
    <li><a href="#ref-for-concept-read-all-bytes-from-readablestream①">3.3.4. The arrayBuffer() method</a>
    <li><a href="#ref-for-concept-read-all-bytes-from-readablestream②">6.5.1.2. The readAsText()</a>
    <li><a href="#ref-for-concept-read-all-bytes-from-readablestream③">6.5.1.3. The readAsDataURL() method</a>
    <li><a href="#ref-for-concept-read-all-bytes-from-readablestream④">6.5.1.4. The readAsArrayBuffer() method</a>
    <li><a href="#ref-for-concept-read-all-bytes-from-readablestream⑤">6.5.1.5. The readAsBinaryString() method</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dom-body-text">
   <a href="https://fetch.spec.whatwg.org/#dom-body-text">https://fetch.spec.whatwg.org/#dom-body-text</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-body-text">3.3.3. The text() method</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-datatransfer">
   <a href="https://html.spec.whatwg.org/multipage/dnd.html#datatransfer">https://html.spec.whatwg.org/multipage/dnd.html#datatransfer</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-datatransfer①">5.2. Methods and Parameters</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-eventhandler">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-eventhandler">6.2. The FileReader API</a> <a href="#ref-for-eventhandler①">(2)</a> <a href="#ref-for-eventhandler②">(3)</a> <a href="#ref-for-eventhandler③">(4)</a> <a href="#ref-for-eventhandler④">(5)</a> <a href="#ref-for-eventhandler⑤">(6)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-htmlinputelement">
   <a href="https://html.spec.whatwg.org/multipage/input.html#htmlinputelement">https://html.spec.whatwg.org/multipage/input.html#htmlinputelement</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-htmlinputelement">5.2. Methods and Parameters</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-serializable">
   <a href="https://html.spec.whatwg.org/multipage/structured-data.html#serializable">https://html.spec.whatwg.org/multipage/structured-data.html#serializable</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-serializable">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-serializable①">4. The File Interface</a>
    <li><a href="#ref-for-serializable②">5. The FileList Interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-the-a-element">
   <a href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element">https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-the-a-element">10. Requirements and Use Cases</a> <a href="#ref-for-the-a-element①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-ascii-serialisation-of-an-origin">
   <a href="https://html.spec.whatwg.org/multipage/origin.html#ascii-serialisation-of-an-origin">https://html.spec.whatwg.org/multipage/origin.html#ascii-serialisation-of-an-origin</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-serialisation-of-an-origin">8.2. Model</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-current-settings-object">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#current-settings-object">https://html.spec.whatwg.org/multipage/webappapis.html#current-settings-object</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-current-settings-object">8.2. Model</a> <a href="#ref-for-current-settings-object①">(2)</a>
    <li><a href="#ref-for-current-settings-object②">8.4. Creating and Revoking a blob URL</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-deserialization-steps">
   <a href="https://html.spec.whatwg.org/multipage/structured-data.html#deserialization-steps">https://html.spec.whatwg.org/multipage/structured-data.html#deserialization-steps</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-deserialization-steps">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-deserialization-steps①">4. The File Interface</a>
    <li><a href="#ref-for-deserialization-steps②">5. The FileList Interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-environment-settings-object">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object">https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-environment-settings-object">8.2. Model</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-event-handler-content-attributes">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-content-attributes">https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-content-attributes</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-event-handler-content-attributes">6.2.1. Event Handler Content Attributes</a> <a href="#ref-for-event-handler-content-attributes①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-event-handler-event-type">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type">https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-event-handler-event-type">6.2.1. Event Handler Content Attributes</a> <a href="#ref-for-event-handler-event-type①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-the-iframe-element">
   <a href="https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element">https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-the-iframe-element">8.4. Creating and Revoking a blob URL</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-the-img-element">
   <a href="https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element">https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-the-img-element">8.1. Introduction</a>
    <li><a href="#ref-for-the-img-element①">8.4.1. Examples of blob URL Creation and Revocation</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-in-parallel">
   <a href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel">https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-in-parallel">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-in-parallel①">6.2. The FileReader API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-the-input-element">
   <a href="https://html.spec.whatwg.org/multipage/input.html#the-input-element">https://html.spec.whatwg.org/multipage/input.html#the-input-element</a><b>Referenced in:</b>
   <ul></ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-settings-object-origin">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin">https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-settings-object-origin">8.2. Model</a>
    <li><a href="#ref-for-concept-settings-object-origin①">8.4. Creating and Revoking a blob URL</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dom-worker-postmessage-options">
   <a href="https://html.spec.whatwg.org/multipage/workers.html#dom-worker-postmessage-options">https://html.spec.whatwg.org/multipage/workers.html#dom-worker-postmessage-options</a><b>Referenced in:</b>
   <ul></ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-queue-a-task">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-queue-a-task">6.1. The File Reading Task Source</a>
    <li><a href="#ref-for-queue-a-task①">6.2. The FileReader API</a> <a href="#ref-for-queue-a-task②">(2)</a> <a href="#ref-for-queue-a-task③">(3)</a> <a href="#ref-for-queue-a-task④">(4)</a>
    <li><a href="#ref-for-queue-a-task⑤">6.2.3.5. The abort() method</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-relevant-settings-object">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object">https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-relevant-settings-object">8.3.2. Lifetime of blob URLs</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-same-origin">
   <a href="https://html.spec.whatwg.org/multipage/origin.html#same-origin">https://html.spec.whatwg.org/multipage/origin.html#same-origin</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-same-origin">8.4. Creating and Revoking a blob URL</a> <a href="#ref-for-same-origin①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-serializable-objects">
   <a href="https://html.spec.whatwg.org/multipage/structured-data.html#serializable-objects">https://html.spec.whatwg.org/multipage/structured-data.html#serializable-objects</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-serializable-objects">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-serializable-objects①">4. The File Interface</a>
    <li><a href="#ref-for-serializable-objects②">5. The FileList Interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-serialization-steps">
   <a href="https://html.spec.whatwg.org/multipage/structured-data.html#serialization-steps">https://html.spec.whatwg.org/multipage/structured-data.html#serialization-steps</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-serialization-steps">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-serialization-steps①">4. The File Interface</a>
    <li><a href="#ref-for-serialization-steps②">5. The FileList Interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-sub-deserialization">
   <a href="https://html.spec.whatwg.org/multipage/structured-data.html#sub-deserialization">https://html.spec.whatwg.org/multipage/structured-data.html#sub-deserialization</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sub-deserialization">5. The FileList Interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-sub-serialization">
   <a href="https://html.spec.whatwg.org/multipage/structured-data.html#sub-serialization">https://html.spec.whatwg.org/multipage/structured-data.html#sub-serialization</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-sub-serialization">5. The FileList Interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-task">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-task">https://html.spec.whatwg.org/multipage/webappapis.html#concept-task</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-task">6.2.3.5. The abort() method</a> <a href="#ref-for-concept-task①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-task-source">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#task-source">https://html.spec.whatwg.org/multipage/webappapis.html#task-source</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-task-source">6.1. The File Reading Task Source</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-unloading-document-cleanup-steps">
   <a href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#unloading-document-cleanup-steps">https://html.spec.whatwg.org/multipage/browsing-the-web.html#unloading-document-cleanup-steps</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-unloading-document-cleanup-steps">8.3.2. Lifetime of blob URLs</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-ascii-lowercase">
   <a href="https://infra.spec.whatwg.org/#ascii-lowercase">https://infra.spec.whatwg.org/#ascii-lowercase</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-lowercase">3.1. Constructors</a>
    <li><a href="#ref-for-ascii-lowercase①">3.3.1. The slice() method</a>
    <li><a href="#ref-for-ascii-lowercase②">4.1. Constructor</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-assert">
   <a href="https://infra.spec.whatwg.org/#assert">https://infra.spec.whatwg.org/#assert</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-assert">8.3. Dereferencing Model for blob URLs</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-byte">
   <a href="https://infra.spec.whatwg.org/#byte">https://infra.spec.whatwg.org/#byte</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-byte">3. The Blob Interface and Binary Data</a> <a href="#ref-for-byte①">(2)</a>
    <li><a href="#ref-for-byte②">3.1. Constructors</a>
    <li><a href="#ref-for-byte③">3.2. Attributes</a> <a href="#ref-for-byte④">(2)</a> <a href="#ref-for-byte⑤">(3)</a>
    <li><a href="#ref-for-byte⑥">3.3.1. The slice() method</a> <a href="#ref-for-byte⑦">(2)</a>
    <li><a href="#ref-for-byte⑧">4. The File Interface</a> <a href="#ref-for-byte⑨">(2)</a>
    <li><a href="#ref-for-byte①⓪">4.1. Constructor</a> <a href="#ref-for-byte①①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-byte-sequence">
   <a href="https://infra.spec.whatwg.org/#byte-sequence">https://infra.spec.whatwg.org/#byte-sequence</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-byte-sequence">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-byte-sequence①">6.2. The FileReader API</a> <a href="#ref-for-byte-sequence②">(2)</a>
    <li><a href="#ref-for-byte-sequence③">6.5.1.2. The readAsText()</a>
    <li><a href="#ref-for-byte-sequence④">6.5.1.3. The readAsDataURL() method</a>
    <li><a href="#ref-for-byte-sequence⑤">6.5.1.4. The readAsArrayBuffer() method</a>
    <li><a href="#ref-for-byte-sequence⑥">6.5.1.5. The readAsBinaryString() method</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-code-point">
   <a href="https://infra.spec.whatwg.org/#code-point">https://infra.spec.whatwg.org/#code-point</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-code-point">3.1.1. Constructor Parameters</a> <a href="#ref-for-code-point①">(2)</a> <a href="#ref-for-code-point②">(3)</a> <a href="#ref-for-code-point③">(4)</a> <a href="#ref-for-code-point④">(5)</a> <a href="#ref-for-code-point⑤">(6)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-collect-a-sequence-of-code-points">
   <a href="https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points">https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-collect-a-sequence-of-code-points">3.1.1. Constructor Parameters</a> <a href="#ref-for-collect-a-sequence-of-code-points①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-map-exists">
   <a href="https://infra.spec.whatwg.org/#map-exists">https://infra.spec.whatwg.org/#map-exists</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-map-exists">8.3. Dereferencing Model for blob URLs</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-list-iterate">
   <a href="https://infra.spec.whatwg.org/#list-iterate">https://infra.spec.whatwg.org/#list-iterate</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-iterate">5. The FileList Interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-map-key">
   <a href="https://infra.spec.whatwg.org/#map-key">https://infra.spec.whatwg.org/#map-key</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-map-key">8.2. Model</a> <a href="#ref-for-map-key①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-list">
   <a href="https://infra.spec.whatwg.org/#list">https://infra.spec.whatwg.org/#list</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list">5. The FileList Interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-ordered-map">
   <a href="https://infra.spec.whatwg.org/#ordered-map">https://infra.spec.whatwg.org/#ordered-map</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ordered-map">8.2. Model</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-string-position-variable">
   <a href="https://infra.spec.whatwg.org/#string-position-variable">https://infra.spec.whatwg.org/#string-position-variable</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-string-position-variable">3.1.1. Constructor Parameters</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-map-remove">
   <a href="https://infra.spec.whatwg.org/#map-remove">https://infra.spec.whatwg.org/#map-remove</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-map-remove">8.2. Model</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-map-set">
   <a href="https://infra.spec.whatwg.org/#map-set">https://infra.spec.whatwg.org/#map-set</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-map-set">8.2. Model</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-string">
   <a href="https://infra.spec.whatwg.org/#string">https://infra.spec.whatwg.org/#string</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-string">3.1.1. Constructor Parameters</a> <a href="#ref-for-string①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-map-value">
   <a href="https://infra.spec.whatwg.org/#map-value">https://infra.spec.whatwg.org/#map-value</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-map-value">8.2. Model</a>
    <li><a href="#ref-for-map-value①">8.3.2. Lifetime of blob URLs</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-mediasource">
   <a href="http://w3c.github.io/media-source/#mediasource">http://w3c.github.io/media-source/#mediasource</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-mediasource">8. A URL for Blob and MediaSource reference</a>
    <li><a href="#ref-for-mediasource①">8.1. Introduction</a>
    <li><a href="#ref-for-mediasource②">8.2. Model</a>
    <li><a href="#ref-for-mediasource③">8.4. Creating and Revoking a blob URL</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-parameters">
   <a href="https://mimesniff.spec.whatwg.org/#parameters">https://mimesniff.spec.whatwg.org/#parameters</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-parameters">6.3. Packaging data</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-parsable-mime-type">
   <a href="https://mimesniff.spec.whatwg.org/#parsable-mime-type">https://mimesniff.spec.whatwg.org/#parsable-mime-type</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-parsable-mime-type">3.2. Attributes</a> <a href="#ref-for-parsable-mime-type①">(2)</a>
    <li><a href="#ref-for-parsable-mime-type②">4. The File Interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-parse-a-mime-type">
   <a href="https://mimesniff.spec.whatwg.org/#parse-a-mime-type">https://mimesniff.spec.whatwg.org/#parse-a-mime-type</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-parse-a-mime-type">3.2. Attributes</a>
    <li><a href="#ref-for-parse-a-mime-type①">6.3. Packaging data</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-chunk">
   <a href="https://streams.spec.whatwg.org/#chunk">https://streams.spec.whatwg.org/#chunk</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-chunk">3. The Blob Interface and Binary Data</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-AElementDownloadAttribute">
   <a href="https://svgwg.org/svg2-draft/linking.html#AElementDownloadAttribute">https://svgwg.org/svg2-draft/linking.html#AElementDownloadAttribute</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-AElementDownloadAttribute">10. Requirements and Use Cases</a> <a href="#ref-for-AElementDownloadAttribute①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-url">
   <a href="https://url.spec.whatwg.org/#url">https://url.spec.whatwg.org/#url</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-url">8.1. Introduction</a>
    <li><a href="#ref-for-url①">8.4. Creating and Revoking a blob URL</a> <a href="#ref-for-url②">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-empty-host">
   <a href="https://url.spec.whatwg.org/#empty-host">https://url.spec.whatwg.org/#empty-host</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-empty-host">8.2. Model</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-url-origin">
   <a href="https://url.spec.whatwg.org/#concept-url-origin">https://url.spec.whatwg.org/#concept-url-origin</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-origin">8.4. Creating and Revoking a blob URL</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-url-path">
   <a href="https://url.spec.whatwg.org/#concept-url-path">https://url.spec.whatwg.org/#concept-url-path</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-path">8.2. Model</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-url-scheme">
   <a href="https://url.spec.whatwg.org/#concept-url-scheme">https://url.spec.whatwg.org/#concept-url-scheme</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-scheme">8. A URL for Blob and MediaSource reference</a>
    <li><a href="#ref-for-concept-url-scheme①">8.2. Model</a>
    <li><a href="#ref-for-concept-url-scheme②">8.3. Dereferencing Model for blob URLs</a>
    <li><a href="#ref-for-concept-url-scheme③">8.4. Creating and Revoking a blob URL</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-url">
   <a href="https://url.spec.whatwg.org/#concept-url">https://url.spec.whatwg.org/#concept-url</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url">8. A URL for Blob and MediaSource reference</a>
    <li><a href="#ref-for-concept-url①">8.1. Introduction</a>
    <li><a href="#ref-for-concept-url②">8.2. Model</a>
    <li><a href="#ref-for-concept-url③">8.3. Dereferencing Model for blob URLs</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-url-parser">
   <a href="https://url.spec.whatwg.org/#concept-url-parser">https://url.spec.whatwg.org/#concept-url-parser</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-parser">8.2. Model</a>
    <li><a href="#ref-for-concept-url-parser①">8.4. Creating and Revoking a blob URL</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-url-serializer">
   <a href="https://url.spec.whatwg.org/#concept-url-serializer">https://url.spec.whatwg.org/#concept-url-serializer</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-serializer">8.2. Model</a>
    <li><a href="#ref-for-concept-url-serializer①">8.3. Dereferencing Model for blob URLs</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-valid-url-string">
   <a href="https://url.spec.whatwg.org/#valid-url-string">https://url.spec.whatwg.org/#valid-url-string</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valid-url-string">8.2. Model</a> <a href="#ref-for-valid-url-string①">(2)</a> <a href="#ref-for-valid-url-string②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-ArrayBuffer">
   <a href="https://heycam.github.io/webidl/#idl-ArrayBuffer">https://heycam.github.io/webidl/#idl-ArrayBuffer</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-ArrayBuffer">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-idl-ArrayBuffer①">3.3.4. The arrayBuffer() method</a>
    <li><a href="#ref-for-idl-ArrayBuffer②">6.2. The FileReader API</a> <a href="#ref-for-idl-ArrayBuffer③">(2)</a>
    <li><a href="#ref-for-idl-ArrayBuffer④">6.5.1. The FileReaderSync API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-BufferSource">
   <a href="https://heycam.github.io/webidl/#BufferSource">https://heycam.github.io/webidl/#BufferSource</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-BufferSource">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-BufferSource①">3.1.1. Constructor Parameters</a> <a href="#ref-for-BufferSource②">(2)</a>
    <li><a href="#ref-for-BufferSource③">4.1.1. Constructor Parameters</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-Clamp">
   <a href="https://heycam.github.io/webidl/#Clamp">https://heycam.github.io/webidl/#Clamp</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-Clamp">3. The Blob Interface and Binary Data</a> <a href="#ref-for-Clamp①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-DOMException">
   <a href="https://heycam.github.io/webidl/#idl-DOMException">https://heycam.github.io/webidl/#idl-DOMException</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-DOMException">6.2. The FileReader API</a> <a href="#ref-for-idl-DOMException①">(2)</a> <a href="#ref-for-idl-DOMException②">(3)</a>
    <li><a href="#ref-for-idl-DOMException③">7.1. Throwing an Exception or Returning an Error</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-DOMString">
   <a href="https://heycam.github.io/webidl/#idl-DOMString">https://heycam.github.io/webidl/#idl-DOMString</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-DOMString">3. The Blob Interface and Binary Data</a> <a href="#ref-for-idl-DOMString①">(2)</a> <a href="#ref-for-idl-DOMString②">(3)</a>
    <li><a href="#ref-for-idl-DOMString③">3.2. Attributes</a>
    <li><a href="#ref-for-idl-DOMString④">4. The File Interface</a>
    <li><a href="#ref-for-idl-DOMString⑤">4.2. Attributes</a>
    <li><a href="#ref-for-idl-DOMString⑥">6.2. The FileReader API</a> <a href="#ref-for-idl-DOMString⑦">(2)</a> <a href="#ref-for-idl-DOMString⑧">(3)</a>
    <li><a href="#ref-for-idl-DOMString⑨">6.5.1. The FileReaderSync API</a> <a href="#ref-for-idl-DOMString①⓪">(2)</a> <a href="#ref-for-idl-DOMString①①">(3)</a> <a href="#ref-for-idl-DOMString①②">(4)</a>
    <li><a href="#ref-for-idl-DOMString①③">8.4. Creating and Revoking a blob URL</a> <a href="#ref-for-idl-DOMString①④">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-Exposed">
   <a href="https://heycam.github.io/webidl/#Exposed">https://heycam.github.io/webidl/#Exposed</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-Exposed">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-Exposed①">4. The File Interface</a>
    <li><a href="#ref-for-Exposed②">5. The FileList Interface</a>
    <li><a href="#ref-for-Exposed③">6.2. The FileReader API</a>
    <li><a href="#ref-for-Exposed④">6.5.1. The FileReaderSync API</a>
    <li><a href="#ref-for-Exposed⑤">8.4. Creating and Revoking a blob URL</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-invalidstateerror">
   <a href="https://heycam.github.io/webidl/#invalidstateerror">https://heycam.github.io/webidl/#invalidstateerror</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-invalidstateerror">6.2. The FileReader API</a>
    <li><a href="#ref-for-invalidstateerror①">6.2.3. Reading a File or Blob</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-NewObject">
   <a href="https://heycam.github.io/webidl/#NewObject">https://heycam.github.io/webidl/#NewObject</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-NewObject">3. The Blob Interface and Binary Data</a> <a href="#ref-for-NewObject①">(2)</a> <a href="#ref-for-NewObject②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-notfounderror">
   <a href="https://heycam.github.io/webidl/#notfounderror">https://heycam.github.io/webidl/#notfounderror</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-notfounderror">4.2. Attributes</a> <a href="#ref-for-notfounderror①">(2)</a>
    <li><a href="#ref-for-notfounderror②">7. Errors and Exceptions</a>
    <li><a href="#ref-for-notfounderror③">7.1. Throwing an Exception or Returning an Error</a> <a href="#ref-for-notfounderror④">(2)</a> <a href="#ref-for-notfounderror⑤">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-notreadableerror">
   <a href="https://heycam.github.io/webidl/#notreadableerror">https://heycam.github.io/webidl/#notreadableerror</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-notreadableerror">7. Errors and Exceptions</a>
    <li><a href="#ref-for-notreadableerror①">7.1. Throwing an Exception or Returning an Error</a> <a href="#ref-for-notreadableerror②">(2)</a> <a href="#ref-for-notreadableerror③">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-securityerror">
   <a href="https://heycam.github.io/webidl/#securityerror">https://heycam.github.io/webidl/#securityerror</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-securityerror">7. Errors and Exceptions</a>
    <li><a href="#ref-for-securityerror①">7.1. Throwing an Exception or Returning an Error</a> <a href="#ref-for-securityerror②">(2)</a> <a href="#ref-for-securityerror③">(3)</a>
    <li><a href="#ref-for-securityerror④">9. Security and Privacy Considerations</a> <a href="#ref-for-securityerror⑤">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-USVString">
   <a href="https://heycam.github.io/webidl/#idl-USVString">https://heycam.github.io/webidl/#idl-USVString</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-USVString">3. The Blob Interface and Binary Data</a> <a href="#ref-for-idl-USVString①">(2)</a>
    <li><a href="#ref-for-idl-USVString②">3.1.1. Constructor Parameters</a> <a href="#ref-for-idl-USVString③">(2)</a> <a href="#ref-for-idl-USVString④">(3)</a>
    <li><a href="#ref-for-idl-USVString⑤">4. The File Interface</a>
    <li><a href="#ref-for-idl-USVString⑥">4.1.1. Constructor Parameters</a> <a href="#ref-for-idl-USVString⑦">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dfn-get-buffer-source-copy">
   <a href="https://heycam.github.io/webidl/#dfn-get-buffer-source-copy">https://heycam.github.io/webidl/#dfn-get-buffer-source-copy</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-get-buffer-source-copy">3.1.1. Constructor Parameters</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-long-long">
   <a href="https://heycam.github.io/webidl/#idl-long-long">https://heycam.github.io/webidl/#idl-long-long</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-long-long">3. The Blob Interface and Binary Data</a> <a href="#ref-for-idl-long-long①">(2)</a>
    <li><a href="#ref-for-idl-long-long②">4. The File Interface</a> <a href="#ref-for-idl-long-long③">(2)</a>
    <li><a href="#ref-for-idl-long-long④">4.2. Attributes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dfn-supported-property-indices">
   <a href="https://heycam.github.io/webidl/#dfn-supported-property-indices">https://heycam.github.io/webidl/#dfn-supported-property-indices</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-supported-property-indices">5.2. Methods and Parameters</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dfn-throw">
   <a href="https://heycam.github.io/webidl/#dfn-throw">https://heycam.github.io/webidl/#dfn-throw</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-throw">7.1. Throwing an Exception or Returning an Error</a> <a href="#ref-for-dfn-throw①">(2)</a> <a href="#ref-for-dfn-throw②">(3)</a> <a href="#ref-for-dfn-throw③">(4)</a>
    <li><a href="#ref-for-dfn-throw④">9. Security and Privacy Considerations</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-unsigned-long">
   <a href="https://heycam.github.io/webidl/#idl-unsigned-long">https://heycam.github.io/webidl/#idl-unsigned-long</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-unsigned-long">5. The FileList Interface</a> <a href="#ref-for-idl-unsigned-long①">(2)</a>
    <li><a href="#ref-for-idl-unsigned-long②">5.1. Attributes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-unsigned-long-long">
   <a href="https://heycam.github.io/webidl/#idl-unsigned-long-long">https://heycam.github.io/webidl/#idl-unsigned-long-long</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-unsigned-long-long">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-idl-unsigned-long-long①">3.2. Attributes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-unsigned-short">
   <a href="https://heycam.github.io/webidl/#idl-unsigned-short">https://heycam.github.io/webidl/#idl-unsigned-short</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-unsigned-short">6.2. The FileReader API</a> <a href="#ref-for-idl-unsigned-short①">(2)</a> <a href="#ref-for-idl-unsigned-short②">(3)</a> <a href="#ref-for-idl-unsigned-short③">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-progressevent">
   <a href="https://xhr.spec.whatwg.org/#progressevent">https://xhr.spec.whatwg.org/#progressevent</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-progressevent">6.4. Events</a>
    <li><a href="#ref-for-progressevent①">6.4.1. Event Summary</a> <a href="#ref-for-progressevent②">(2)</a> <a href="#ref-for-progressevent③">(3)</a> <a href="#ref-for-progressevent④">(4)</a> <a href="#ref-for-progressevent⑤">(5)</a> <a href="#ref-for-progressevent⑥">(6)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-xmlhttprequest">
   <a href="https://xhr.spec.whatwg.org/#xmlhttprequest">https://xhr.spec.whatwg.org/#xmlhttprequest</a><b>Referenced in:</b>
   <ul></ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dom-xmlhttprequest-send">
   <a href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send">https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send</a><b>Referenced in:</b>
   <ul></ul>
  </aside>
  <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3>
  <ul class="index">
   <li>
    <a data-link-type="biblio">[DOM]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-document" style="color:initial">Document</span>
     <li><span class="dfn-paneled" id="term-for-eventtarget" style="color:initial">EventTarget</span>
     <li><span class="dfn-paneled" id="term-for-context-object" style="color:initial">context object</span>
     <li><span class="dfn-paneled" id="term-for-concept-event-fire" style="color:initial">fire an event</span>
    </ul>
   <li>
    <a data-link-type="biblio">[ECMA-262]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-sec-array-constructor" style="color:initial">Array</span>
     <li><span class="dfn-paneled" id="term-for-sec-date-constructor" style="color:initial">Date</span>
    </ul>
   <li>
    <a data-link-type="biblio">[ENCODING]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-decode" style="color:initial">decode</span>
     <li><span class="dfn-paneled" id="term-for-concept-encoding-get" style="color:initial">getting an encoding</span>
     <li><span class="dfn-paneled" id="term-for-utf-8" style="color:initial">utf-8</span>
     <li><span class="dfn-paneled" id="term-for-utf-8-decode" style="color:initial">utf-8 decode</span>
     <li><span class="dfn-paneled" id="term-for-utf-8-encode" style="color:initial">utf-8 encode</span>
    </ul>
   <li>
    <a data-link-type="biblio">[Fetch]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-concept-readablestream" style="color:initial">ReadableStream</span>
     <li><span class="dfn-paneled" id="term-for-concept-construct-readablestream" style="color:initial">construct a readablestream object</span>
     <li><span class="dfn-paneled" id="term-for-concept-enqueue-readablestream" style="color:initial">enqueue</span>
     <li><span class="dfn-paneled" id="term-for-concept-error-readablestream" style="color:initial">error</span>
     <li><span class="dfn-paneled" id="term-for-concept-fetch" style="color:initial">fetch</span>
     <li><span class="dfn-paneled" id="term-for-concept-get-reader" style="color:initial">get a reader</span>
     <li><span class="dfn-paneled" id="term-for-concept-network-error" style="color:initial">network error</span>
     <li><span class="dfn-paneled" id="term-for-concept-read-chunk-from-readablestream" style="color:initial">read a chunk</span>
     <li><span class="dfn-paneled" id="term-for-concept-read-all-bytes-from-readablestream" style="color:initial">read all bytes</span>
     <li><span class="dfn-paneled" id="term-for-dom-body-text" style="color:initial">text()</span>
    </ul>
   <li>
    <a data-link-type="biblio">[HTML]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-datatransfer" style="color:initial">DataTransfer</span>
     <li><span class="dfn-paneled" id="term-for-eventhandler" style="color:initial">EventHandler</span>
     <li><span class="dfn-paneled" id="term-for-htmlinputelement" style="color:initial">HTMLInputElement</span>
     <li><span class="dfn-paneled" id="term-for-serializable" style="color:initial">Serializable</span>
     <li><span class="dfn-paneled" id="term-for-the-a-element" style="color:initial">a</span>
     <li><span class="dfn-paneled" id="term-for-ascii-serialisation-of-an-origin" style="color:initial">ascii serialization of an origin</span>
     <li><span class="dfn-paneled" id="term-for-current-settings-object" style="color:initial">current settings object</span>
     <li><span class="dfn-paneled" id="term-for-deserialization-steps" style="color:initial">deserialization steps</span>
     <li><span class="dfn-paneled" id="term-for-environment-settings-object" style="color:initial">environment settings object</span>
     <li><span class="dfn-paneled" id="term-for-event-handler-content-attributes" style="color:initial">event handler content attribute</span>
     <li><span class="dfn-paneled" id="term-for-event-handler-event-type" style="color:initial">event handler event type</span>
     <li><span class="dfn-paneled" id="term-for-the-iframe-element" style="color:initial">iframe</span>
     <li><span class="dfn-paneled" id="term-for-the-img-element" style="color:initial">img</span>
     <li><span class="dfn-paneled" id="term-for-in-parallel" style="color:initial">in parallel</span>
     <li><span class="dfn-paneled" id="term-for-the-input-element" style="color:initial">input</span>
     <li><span class="dfn-paneled" id="term-for-concept-settings-object-origin" style="color:initial">origin</span>
     <li><span class="dfn-paneled" id="term-for-dom-worker-postmessage-options" style="color:initial">postMessage(message, options)</span>
     <li><span class="dfn-paneled" id="term-for-queue-a-task" style="color:initial">queue a task</span>
     <li><span class="dfn-paneled" id="term-for-relevant-settings-object" style="color:initial">relevant settings object</span>
     <li><span class="dfn-paneled" id="term-for-same-origin" style="color:initial">same origin</span>
     <li><span class="dfn-paneled" id="term-for-serializable-objects" style="color:initial">serializable objects</span>
     <li><span class="dfn-paneled" id="term-for-serialization-steps" style="color:initial">serialization steps</span>
     <li><span class="dfn-paneled" id="term-for-sub-deserialization" style="color:initial">sub-deserialization</span>
     <li><span class="dfn-paneled" id="term-for-sub-serialization" style="color:initial">sub-serialization</span>
     <li><span class="dfn-paneled" id="term-for-concept-task" style="color:initial">task</span>
     <li><span class="dfn-paneled" id="term-for-task-source" style="color:initial">task source</span>
     <li><span class="dfn-paneled" id="term-for-unloading-document-cleanup-steps" style="color:initial">unloading document cleanup steps</span>
    </ul>
   <li>
    <a data-link-type="biblio">[INFRA]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-ascii-lowercase" style="color:initial">ascii lowercase</span>
     <li><span class="dfn-paneled" id="term-for-assert" style="color:initial">assert</span>
     <li><span class="dfn-paneled" id="term-for-byte" style="color:initial">byte</span>
     <li><span class="dfn-paneled" id="term-for-byte-sequence" style="color:initial">byte sequence</span>
     <li><span class="dfn-paneled" id="term-for-code-point" style="color:initial">code point</span>
     <li><span class="dfn-paneled" id="term-for-collect-a-sequence-of-code-points" style="color:initial">collecting a sequence of code points</span>
     <li><span class="dfn-paneled" id="term-for-map-exists" style="color:initial">exist</span>
     <li><span class="dfn-paneled" id="term-for-list-iterate" style="color:initial">for each</span>
     <li><span class="dfn-paneled" id="term-for-map-key" style="color:initial">key</span>
     <li><span class="dfn-paneled" id="term-for-list" style="color:initial">list</span>
     <li><span class="dfn-paneled" id="term-for-ordered-map" style="color:initial">map</span>
     <li><span class="dfn-paneled" id="term-for-string-position-variable" style="color:initial">position variable</span>
     <li><span class="dfn-paneled" id="term-for-map-remove" style="color:initial">remove</span>
     <li><span class="dfn-paneled" id="term-for-map-set" style="color:initial">set</span>
     <li><span class="dfn-paneled" id="term-for-string" style="color:initial">string</span>
     <li><span class="dfn-paneled" id="term-for-map-value" style="color:initial">value</span>
    </ul>
   <li>
    <a data-link-type="biblio">[media-source]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-mediasource" style="color:initial">MediaSource</span>
    </ul>
   <li>
    <a data-link-type="biblio">[MIMESNIFF]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-parameters" style="color:initial">parameters</span>
     <li><span class="dfn-paneled" id="term-for-parsable-mime-type" style="color:initial">parsable mime type</span>
     <li><span class="dfn-paneled" id="term-for-parse-a-mime-type" style="color:initial">parse a mime type</span>
    </ul>
   <li>
    <a data-link-type="biblio">[STREAMS]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-chunk" style="color:initial">chunk</span>
    </ul>
   <li>
    <a data-link-type="biblio">[SVG2]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-AElementDownloadAttribute" style="color:initial">download</span>
    </ul>
   <li>
    <a data-link-type="biblio">[URL]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-url" style="color:initial">URL</span>
     <li><span class="dfn-paneled" id="term-for-empty-host" style="color:initial">empty host</span>
     <li><span class="dfn-paneled" id="term-for-concept-url-origin" style="color:initial">origin</span>
     <li><span class="dfn-paneled" id="term-for-concept-url-path" style="color:initial">path</span>
     <li><span class="dfn-paneled" id="term-for-concept-url-scheme" style="color:initial">scheme</span>
     <li><span class="dfn-paneled" id="term-for-concept-url" style="color:initial">url</span>
     <li><span class="dfn-paneled" id="term-for-concept-url-parser" style="color:initial">url parser</span>
     <li><span class="dfn-paneled" id="term-for-concept-url-serializer" style="color:initial">url serializer</span>
     <li><span class="dfn-paneled" id="term-for-valid-url-string" style="color:initial">valid url string</span>
    </ul>
   <li>
    <a data-link-type="biblio">[WebIDL]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-idl-ArrayBuffer" style="color:initial">ArrayBuffer</span>
     <li><span class="dfn-paneled" id="term-for-BufferSource" style="color:initial">BufferSource</span>
     <li><span class="dfn-paneled" id="term-for-Clamp" style="color:initial">Clamp</span>
     <li><span class="dfn-paneled" id="term-for-idl-DOMException" style="color:initial">DOMException</span>
     <li><span class="dfn-paneled" id="term-for-idl-DOMString" style="color:initial">DOMString</span>
     <li><span class="dfn-paneled" id="term-for-Exposed" style="color:initial">Exposed</span>
     <li><span class="dfn-paneled" id="term-for-invalidstateerror" style="color:initial">InvalidStateError</span>
     <li><span class="dfn-paneled" id="term-for-NewObject" style="color:initial">NewObject</span>
     <li><span class="dfn-paneled" id="term-for-notfounderror" style="color:initial">NotFoundError</span>
     <li><span class="dfn-paneled" id="term-for-notreadableerror" style="color:initial">NotReadableError</span>
     <li><span class="dfn-paneled" id="term-for-securityerror" style="color:initial">SecurityError</span>
     <li><span class="dfn-paneled" id="term-for-idl-USVString" style="color:initial">USVString</span>
     <li><span class="dfn-paneled" id="term-for-dfn-get-buffer-source-copy" style="color:initial">get a copy of the buffer source</span>
     <li><span class="dfn-paneled" id="term-for-idl-long-long" style="color:initial">long long</span>
     <li><span class="dfn-paneled" id="term-for-dfn-supported-property-indices" style="color:initial">supported property indices</span>
     <li><span class="dfn-paneled" id="term-for-dfn-throw" style="color:initial">throw</span>
     <li><span class="dfn-paneled" id="term-for-idl-unsigned-long" style="color:initial">unsigned long</span>
     <li><span class="dfn-paneled" id="term-for-idl-unsigned-long-long" style="color:initial">unsigned long long</span>
     <li><span class="dfn-paneled" id="term-for-idl-unsigned-short" style="color:initial">unsigned short</span>
    </ul>
   <li>
    <a data-link-type="biblio">[XHR]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-progressevent" style="color:initial">ProgressEvent</span>
     <li><span class="dfn-paneled" id="term-for-xmlhttprequest" style="color:initial">XMLHttpRequest</span>
     <li><span class="dfn-paneled" id="term-for-dom-xmlhttprequest-send" style="color:initial">send()</span>
    </ul>
  </ul>
  <h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2>
  <h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3>
  <dl>
   <dt id="biblio-dom">[DOM]
   <dd>Anne van Kesteren. <a href="https://dom.spec.whatwg.org/">DOM Standard</a>. Living Standard. URL: <a href="https://dom.spec.whatwg.org/">https://dom.spec.whatwg.org/</a>
   <dt id="biblio-ecma-262">[ECMA-262]
   <dd><a href="https://tc39.github.io/ecma262/">ECMAScript Language Specification</a>. URL: <a href="https://tc39.github.io/ecma262/">https://tc39.github.io/ecma262/</a>
   <dt id="biblio-encoding">[ENCODING]
   <dd>Anne van Kesteren. <a href="https://encoding.spec.whatwg.org/">Encoding Standard</a>. Living Standard. URL: <a href="https://encoding.spec.whatwg.org/">https://encoding.spec.whatwg.org/</a>
   <dt id="biblio-fetch">[Fetch]
   <dd>Anne van Kesteren. <a href="https://fetch.spec.whatwg.org/">Fetch Standard</a>. Living Standard. URL: <a href="https://fetch.spec.whatwg.org/">https://fetch.spec.whatwg.org/</a>
   <dt id="biblio-html">[HTML]
   <dd>Anne van Kesteren; et al. <a href="https://html.spec.whatwg.org/multipage/">HTML Standard</a>. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a>
   <dt id="biblio-infra">[INFRA]
   <dd>Anne van Kesteren; Domenic Denicola. <a href="https://infra.spec.whatwg.org/">Infra Standard</a>. Living Standard. URL: <a href="https://infra.spec.whatwg.org/">https://infra.spec.whatwg.org/</a>
   <dt id="biblio-media-source">[MEDIA-SOURCE]
   <dd>Matthew Wolenetz; et al. <a href="https://www.w3.org/TR/media-source/">Media Source Extensions™</a>. 17 November 2016. REC. URL: <a href="https://www.w3.org/TR/media-source/">https://www.w3.org/TR/media-source/</a>
   <dt id="biblio-mimesniff">[MIMESNIFF]
   <dd>Gordon P. Hemsley. <a href="https://mimesniff.spec.whatwg.org/">MIME Sniffing Standard</a>. Living Standard. URL: <a href="https://mimesniff.spec.whatwg.org/">https://mimesniff.spec.whatwg.org/</a>
   <dt id="biblio-rfc2119">[RFC2119]
   <dd>S. Bradner. <a href="https://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a>. March 1997. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc2119">https://tools.ietf.org/html/rfc2119</a>
   <dt id="biblio-rfc2397">[RFC2397]
   <dd>L. Masinter. <a href="https://tools.ietf.org/html/rfc2397">The "data" URL scheme</a>. August 1998. Proposed Standard. URL: <a href="https://tools.ietf.org/html/rfc2397">https://tools.ietf.org/html/rfc2397</a>
   <dt id="biblio-rfc4122">[RFC4122]
   <dd>P. Leach; M. Mealling; R. Salz. <a href="https://tools.ietf.org/html/rfc4122">A Universally Unique IDentifier (UUID) URN Namespace</a>. July 2005. Proposed Standard. URL: <a href="https://tools.ietf.org/html/rfc4122">https://tools.ietf.org/html/rfc4122</a>
   <dt id="biblio-streams">[STREAMS]
   <dd>Adam Rice; Domenic Denicola; 吉野剛史 (Takeshi Yoshino). <a href="https://streams.spec.whatwg.org/">Streams Standard</a>. Living Standard. URL: <a href="https://streams.spec.whatwg.org/">https://streams.spec.whatwg.org/</a>
   <dt id="biblio-url">[URL]
   <dd>Anne van Kesteren. <a href="https://url.spec.whatwg.org/">URL Standard</a>. Living Standard. URL: <a href="https://url.spec.whatwg.org/">https://url.spec.whatwg.org/</a>
   <dt id="biblio-webidl">[WebIDL]
   <dd>Boris Zbarsky. <a href="https://heycam.github.io/webidl/">Web IDL</a>. 15 December 2016. ED. URL: <a href="https://heycam.github.io/webidl/">https://heycam.github.io/webidl/</a>
   <dt id="biblio-xhr">[XHR]
   <dd>Anne van Kesteren. <a href="https://xhr.spec.whatwg.org/">XMLHttpRequest Standard</a>. Living Standard. URL: <a href="https://xhr.spec.whatwg.org/">https://xhr.spec.whatwg.org/</a>
  </dl>
  <h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3>
  <dl>
   <dt id="biblio-svg2">[SVG2]
   <dd>Amelia Bellamy-Royds; et al. <a href="https://www.w3.org/TR/SVG2/">Scalable Vector Graphics (SVG) 2</a>. 4 October 2018. CR. URL: <a href="https://www.w3.org/TR/SVG2/">https://www.w3.org/TR/SVG2/</a>
   <dt id="biblio-workers">[Workers]
   <dd>Ian Hickson. <a href="https://www.w3.org/TR/workers/">Web Workers</a>. 24 September 2015. WD. URL: <a href="https://www.w3.org/TR/workers/">https://www.w3.org/TR/workers/</a>
  </dl>
  <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">IDL Index</span><a class="self-link" href="#idl-index"></a></h2>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed⑥"><c- g>Exposed</c-></a>=(<c- n>Window</c->,<c- n>Worker</c->), <a class="idl-code" data-link-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#serializable" id="ref-for-serializable③"><c- g>Serializable</c-></a>]
<c- b>interface</c-> <a href="#dfn-Blob"><code><c- g>Blob</c-></code></a> {
  <a href="#dom-blob-blob"><code><c- g>constructor</c-></code></a>(<c- b>optional</c-> <c- b>sequence</c->&lt;<a class="n" data-link-type="idl-name" href="#typedefdef-blobpart" id="ref-for-typedefdef-blobpart③"><c- n>BlobPart</c-></a>> <a class="idl-code" data-link-type="argument" href="#dfn-blobParts" id="ref-for-dfn-blobParts③"><c- g>blobParts</c-></a>,
              <c- b>optional</c-> <a class="n" data-link-type="idl-name" href="#dfn-BlobPropertyBag" id="ref-for-dfn-BlobPropertyBag⑤"><c- n>BlobPropertyBag</c-></a> <a href="#dom-blob-blob-blobparts-options-options"><code><c- g>options</c-></code></a> = {});

  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-long-long" id="ref-for-idl-unsigned-long-long②"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="unsigned long long" href="#dfn-size" id="ref-for-dfn-size①①"><c- g>size</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString①⑤"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="DOMString" href="#dfn-type" id="ref-for-dfn-type①①⓪"><c- g>type</c-></a>;

  // slice Blob into byte-ranged chunks
  <a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob①⓪①"><c- n>Blob</c-></a> <a class="idl-code" data-link-type="method" href="#dfn-slice" id="ref-for-dfn-slice①⓪"><c- g>slice</c-></a>(<c- b>optional</c-> [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Clamp" id="ref-for-Clamp②"><c- g>Clamp</c-></a>] <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-long-long" id="ref-for-idl-long-long⑤"><c- b>long</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="argument" href="#dfn-start" id="ref-for-dfn-start⑥"><c- g>start</c-></a>,
            <c- b>optional</c-> [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Clamp" id="ref-for-Clamp①①"><c- g>Clamp</c-></a>] <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-long-long" id="ref-for-idl-long-long①①"><c- b>long</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="argument" href="#dfn-end" id="ref-for-dfn-end⑤"><c- g>end</c-></a>,
            <c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString①⑥"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="argument" href="#dfn-contentTypeBlob" id="ref-for-dfn-contentTypeBlob⑤"><c- g>contentType</c-></a>);

  // read from the Blob.
  [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#NewObject" id="ref-for-NewObject③"><c- g>NewObject</c-></a>] <a class="n" data-link-type="idl-name" href="https://fetch.spec.whatwg.org/#concept-readablestream" id="ref-for-concept-readablestream②"><c- n>ReadableStream</c-></a> <a class="idl-code" data-link-type="method" href="#dom-blob-stream" id="ref-for-dom-blob-stream②"><c- g>stream</c-></a>();
  [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#NewObject" id="ref-for-NewObject①①"><c- g>NewObject</c-></a>] <c- b>Promise</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString⑧"><c- b>USVString</c-></a>> <a class="idl-code" data-link-type="method" href="#dom-blob-text" id="ref-for-dom-blob-text②"><c- g>text</c-></a>();
  [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#NewObject" id="ref-for-NewObject②①"><c- g>NewObject</c-></a>] <c- b>Promise</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer⑤"><c- b>ArrayBuffer</c-></a>> <a class="idl-code" data-link-type="method" href="#dom-blob-arraybuffer" id="ref-for-dom-blob-arraybuffer②"><c- g>arrayBuffer</c-></a>();
};

<c- b>enum</c-> <a href="#enumdef-endingtype"><code><c- g>EndingType</c-></code></a> { <a href="#dom-endingtype-transparent"><code><c- s>"transparent"</c-></code></a>, <a href="#dom-endingtype-native"><code><c- s>"native"</c-></code></a> };

<c- b>dictionary</c-> <a href="#dfn-BlobPropertyBag"><code><c- g>BlobPropertyBag</c-></code></a> {
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString②①"><c- b>DOMString</c-></a> <a class="idl-code" data-default="&quot;&quot;" data-link-type="dict-member" data-type="DOMString " href="#dfn-BPtype" id="ref-for-dfn-BPtype⑤"><c- g>type</c-></a> = "";
  <a class="n" data-link-type="idl-name" href="#enumdef-endingtype" id="ref-for-enumdef-endingtype①"><c- n>EndingType</c-></a> <a class="idl-code" data-default="&quot;transparent&quot;" data-link-type="dict-member" data-type="EndingType " href="#dom-blobpropertybag-endings" id="ref-for-dom-blobpropertybag-endings②"><c- g>endings</c-></a> = "transparent";
};

<c- b>typedef</c-> (<a class="n" data-link-type="idl-name" href="https://heycam.github.io/webidl/#BufferSource" id="ref-for-BufferSource④"><c- n>BufferSource</c-></a> <c- b>or</c-> <a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob①①①"><c- n>Blob</c-></a> <c- b>or</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①①"><c- b>USVString</c-></a>) <a href="#typedefdef-blobpart"><code><c- g>BlobPart</c-></code></a>;

[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed①①"><c- g>Exposed</c-></a>=(<c- n>Window</c->,<c- n>Worker</c->), <a class="idl-code" data-link-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#serializable" id="ref-for-serializable①①"><c- g>Serializable</c-></a>]
<c- b>interface</c-> <a href="#dfn-file"><code><c- g>File</c-></code></a> : <a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob③②①"><c- n>Blob</c-></a> {
  <a href="#dom-file-file"><code><c- g>constructor</c-></code></a>(<c- b>sequence</c->&lt;<a class="n" data-link-type="idl-name" href="#typedefdef-blobpart" id="ref-for-typedefdef-blobpart②①"><c- n>BlobPart</c-></a>> <a class="idl-code" data-link-type="argument" href="#dfn-fileBits" id="ref-for-dfn-fileBits②"><c- g>fileBits</c-></a>,
              <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString⑤①"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="argument" href="#dfn-fileName" id="ref-for-dfn-fileName③"><c- g>fileName</c-></a>,
              <c- b>optional</c-> <a class="n" data-link-type="idl-name" href="#dfn-FilePropertyBag" id="ref-for-dfn-FilePropertyBag③"><c- n>FilePropertyBag</c-></a> <a href="#dom-file-file-filebits-filename-options-options"><code><c- g>options</c-></code></a> = {});
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString④①"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="DOMString" href="#dfn-name" id="ref-for-dfn-name①①"><c- g>name</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-long-long" id="ref-for-idl-long-long②①"><c- b>long</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="long long" href="#dfn-lastModified" id="ref-for-dfn-lastModified④"><c- g>lastModified</c-></a>;
};

<c- b>dictionary</c-> <a href="#dfn-FilePropertyBag"><code><c- g>FilePropertyBag</c-></code></a> : <a class="n" data-link-type="idl-name" href="#dfn-BlobPropertyBag" id="ref-for-dfn-BlobPropertyBag③①"><c- n>BlobPropertyBag</c-></a> {
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-long-long" id="ref-for-idl-long-long③①"><c- b>long</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="dict-member" data-type="long long " href="#dfn-FPdate" id="ref-for-dfn-FPdate④"><c- g>lastModified</c-></a>;
};

[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed②①"><c- g>Exposed</c-></a>=(<c- n>Window</c->,<c- n>Worker</c->), <a class="idl-code" data-link-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#serializable" id="ref-for-serializable②①"><c- g>Serializable</c-></a>]
<c- b>interface</c-> <a href="#dfn-filelist"><code><c- g>FileList</c-></code></a> {
  <c- b>getter</c-> <a class="n" data-link-type="idl-name" href="#dfn-file" id="ref-for-dfn-file②④①"><c- n>File</c-></a>? <a class="idl-code" data-link-type="method" href="#dfn-item" id="ref-for-dfn-item①"><c- g>item</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-long" id="ref-for-idl-unsigned-long③"><c- b>unsigned</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="argument" href="#dfn-index" id="ref-for-dfn-index①"><c- g>index</c-></a>);
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-long" id="ref-for-idl-unsigned-long①①"><c- b>unsigned</c-> <c- b>long</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="unsigned long" href="#dfn-length" id="ref-for-dfn-length①"><c- g>length</c-></a>;
};

[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed③①"><c- g>Exposed</c-></a>=(<c- n>Window</c->,<c- n>Worker</c->)]
<c- b>interface</c-> <a href="#dfn-filereader"><code><c- g>FileReader</c-></code></a>: <a class="n" data-link-type="idl-name" href="https://dom.spec.whatwg.org/#eventtarget" id="ref-for-eventtarget①"><c- n>EventTarget</c-></a> {
  <a class="idl-code" data-link-type="constructor" href="#filereaderConstrctr" id="ref-for-filereaderConstrctr①"><c- g>constructor</c-></a>();
  // async read methods
  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dfn-readAsArrayBuffer" id="ref-for-dfn-readAsArrayBuffer④"><c- g>readAsArrayBuffer</c-></a>(<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob③⑥①"><c- n>Blob</c-></a> <a href="#dom-filereader-readasarraybuffer-blob-blob"><code><c- g>blob</c-></code></a>);
  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dfn-readAsBinaryString" id="ref-for-dfn-readAsBinaryString④"><c- g>readAsBinaryString</c-></a>(<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob③⑦①"><c- n>Blob</c-></a> <a href="#dom-filereader-readasbinarystring-blob-blob"><code><c- g>blob</c-></code></a>);
  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dfn-readAsText" id="ref-for-dfn-readAsText①①"><c- g>readAsText</c-></a>(<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob③⑧①"><c- n>Blob</c-></a> <a href="#dom-filereader-readastext-blob-encoding-blob"><code><c- g>blob</c-></code></a>, <c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString⑥①"><c- b>DOMString</c-></a> <a href="#dom-filereader-readastext-blob-encoding-encoding"><code><c- g>encoding</c-></code></a>);
  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dfn-readAsDataURL" id="ref-for-dfn-readAsDataURL③"><c- g>readAsDataURL</c-></a>(<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob③⑨①"><c- n>Blob</c-></a> <a href="#dom-filereader-readasdataurl-blob-blob"><code><c- g>blob</c-></code></a>);

  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dfn-abort" id="ref-for-dfn-abort①①"><c- g>abort</c-></a>();

  // states
  <c- b>const</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-short" id="ref-for-idl-unsigned-short④"><c- b>unsigned</c-> <c- b>short</c-></a> <a href="#dom-filereader-empty"><code><c- g>EMPTY</c-></code></a> = 0;
  <c- b>const</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-short" id="ref-for-idl-unsigned-short①①"><c- b>unsigned</c-> <c- b>short</c-></a> <a href="#dom-filereader-loading"><code><c- g>LOADING</c-></code></a> = 1;
  <c- b>const</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-short" id="ref-for-idl-unsigned-short②①"><c- b>unsigned</c-> <c- b>short</c-></a> <a href="#dom-filereader-done"><code><c- g>DONE</c-></code></a> = 2;

  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-short" id="ref-for-idl-unsigned-short③①"><c- b>unsigned</c-> <c- b>short</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="unsigned short" href="#dom-filereader-readystate" id="ref-for-dom-filereader-readystate④"><c- g>readyState</c-></a>;

  // File or Blob data
  <c- b>readonly</c-> <c- b>attribute</c-> (<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString⑦①"><c- b>DOMString</c-></a> <c- b>or</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer②①"><c- b>ArrayBuffer</c-></a>)? <a class="idl-code" data-link-type="attribute" data-readonly data-type="(DOMString or ArrayBuffer)?" href="#dom-filereader-result" id="ref-for-dom-filereader-result①"><c- g>result</c-></a>;

  <c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://heycam.github.io/webidl/#idl-DOMException" id="ref-for-idl-DOMException④"><c- n>DOMException</c-></a>? <a class="idl-code" data-link-type="attribute" data-readonly data-type="DOMException?" href="#dom-filereader-error" id="ref-for-dom-filereader-error①①"><c- g>error</c-></a>;

  // event handler content attributes
  <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler" id="ref-for-eventhandler⑥"><c- n>EventHandler</c-></a> <a class="idl-code" data-link-type="attribute" data-type="EventHandler" href="#dfn-onloadstart" id="ref-for-dfn-onloadstart①"><c- g>onloadstart</c-></a>;
  <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler" id="ref-for-eventhandler①①"><c- n>EventHandler</c-></a> <a class="idl-code" data-link-type="attribute" data-type="EventHandler" href="#dfn-onprogress" id="ref-for-dfn-onprogress①"><c- g>onprogress</c-></a>;
  <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler" id="ref-for-eventhandler②①"><c- n>EventHandler</c-></a> <a class="idl-code" data-link-type="attribute" data-type="EventHandler" href="#dfn-onload" id="ref-for-dfn-onload①"><c- g>onload</c-></a>;
  <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler" id="ref-for-eventhandler③①"><c- n>EventHandler</c-></a> <a class="idl-code" data-link-type="attribute" data-type="EventHandler" href="#dfn-onabort" id="ref-for-dfn-onabort①"><c- g>onabort</c-></a>;
  <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler" id="ref-for-eventhandler④①"><c- n>EventHandler</c-></a> <a class="idl-code" data-link-type="attribute" data-type="EventHandler" href="#dfn-onerror" id="ref-for-dfn-onerror①"><c- g>onerror</c-></a>;
  <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler" id="ref-for-eventhandler⑤①"><c- n>EventHandler</c-></a> <a class="idl-code" data-link-type="attribute" data-type="EventHandler" href="#dfn-onloadend" id="ref-for-dfn-onloadend①"><c- g>onloadend</c-></a>;
};

[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed④①"><c- g>Exposed</c-></a>=(<c- n>DedicatedWorker</c->,<c- n>SharedWorker</c->)]
<c- b>interface</c-> <a href="#dfn-FileReaderSync"><code><c- g>FileReaderSync</c-></code></a> {
  <a href="#dom-filereadersync-filereadersync"><code><c- g>constructor</c-></code></a>();
  // Synchronously return strings

  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer④①"><c- b>ArrayBuffer</c-></a> <a class="idl-code" data-link-type="method" href="#dfn-readAsArrayBufferSync" id="ref-for-dfn-readAsArrayBufferSync③"><c- g>readAsArrayBuffer</c-></a>(<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob④⑥①"><c- n>Blob</c-></a> <a href="#dom-filereadersync-readasarraybuffer-blob-blob"><code><c- g>blob</c-></code></a>);
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString⑨①"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="method" href="#dfn-readAsBinaryStringSync" id="ref-for-dfn-readAsBinaryStringSync③"><c- g>readAsBinaryString</c-></a>(<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob④⑦①"><c- n>Blob</c-></a> <a href="#dom-filereadersync-readasbinarystring-blob-blob"><code><c- g>blob</c-></code></a>);
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString①⓪①"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="method" href="#dfn-readAsTextSync" id="ref-for-dfn-readAsTextSync②"><c- g>readAsText</c-></a>(<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob④⑧①"><c- n>Blob</c-></a> <a href="#dom-filereadersync-readastext-blob-encoding-blob"><code><c- g>blob</c-></code></a>, <c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString①①①"><c- b>DOMString</c-></a> <a href="#dom-filereadersync-readastext-blob-encoding-encoding"><code><c- g>encoding</c-></code></a>);
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString①②①"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="method" href="#dfn-readAsDataURLSync" id="ref-for-dfn-readAsDataURLSync②"><c- g>readAsDataURL</c-></a>(<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob④⑨①"><c- n>Blob</c-></a> <a href="#dom-filereadersync-readasdataurl-blob-blob"><code><c- g>blob</c-></code></a>);
};

[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed⑤①"><c- g>Exposed</c-></a>=(<c- n>Window</c->,<c- n>DedicatedWorker</c->,<c- n>SharedWorker</c->)]
<c- b>partial</c-> <c- b>interface</c-> <a class="idl-code" data-link-type="interface" href="https://url.spec.whatwg.org/#url" id="ref-for-url②①"><c- g>URL</c-></a> {
  <c- b>static</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString①③①"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="method" href="#dfn-createObjectURL" id="ref-for-dfn-createObjectURL①①"><c- g>createObjectURL</c-></a>((<a class="n" data-link-type="idl-name" href="#dfn-Blob" id="ref-for-dfn-Blob⑥④①"><c- n>Blob</c-></a> <c- b>or</c-> <a class="n" data-link-type="idl-name" href="http://w3c.github.io/media-source/#mediasource" id="ref-for-mediasource③①"><c- n>MediaSource</c-></a>) <a href="#dom-url-createobjecturl-obj-obj"><code><c- g>obj</c-></code></a>);
  <c- b>static</c-> <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dfn-revokeObjectURL" id="ref-for-dfn-revokeObjectURL①①"><c- g>revokeObjectURL</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-DOMString" id="ref-for-idl-DOMString①④①"><c- b>DOMString</c-></a> <a href="#dom-url-revokeobjecturl-url-url"><code><c- g>url</c-></code></a>);
};

</pre>
  <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content">Issues Index</span><a class="self-link" href="#issues-index"></a></h2>
  <div style="counter-reset:issue">
   <div class="issue"> We need to specify more concretely what reading from a Blob actually does,
what possible errors can happen, perhaps something about chunk sizes, etc.<a href="#issue-27e70e89"> ↵ </a></div>
   <div class="issue"> We might change <code class="idl"><a data-link-type="idl" href="#dfn-loadstart-event">loadstart</a></code> to be dispatched synchronously,
 to align with XMLHttpRequest behavior. <a href="https://github.com/w3c/FileAPI/issues/119">&lt;https://github.com/w3c/FileAPI/issues/119></a><a href="#issue-0504580b"> ↵ </a></div>
   <div class="issue"> Better specify how the DataURL is generated. <a href="https://github.com/w3c/FileAPI/issues/104">&lt;https://github.com/w3c/FileAPI/issues/104></a><a href="#issue-f80bda5b"> ↵ </a></div>
   <div class="issue"> This needs a similar hook when a worker is unloaded.<a href="#issue-5f2e5a9d"> ↵ </a></div>
   <div class="issue"> This section is provisional; more security data may supplement this in subsequent drafts.<a href="#issue-61296551"> ↵ </a></div>
  </div>
  <aside class="dfn-panel" data-for="terminate-an-algorithm">
   <b><a href="#terminate-an-algorithm">#terminate-an-algorithm</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-terminate-an-algorithm">6.2.3.5. The abort() method</a> <a href="#ref-for-terminate-an-algorithm①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="UnixEpoch">
   <b><a href="#UnixEpoch">#UnixEpoch</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-UnixEpoch">4.1. Constructor</a> <a href="#ref-for-UnixEpoch①">(2)</a>
    <li><a href="#ref-for-UnixEpoch②">4.2. Attributes</a> <a href="#ref-for-UnixEpoch③">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="snapshot-state">
   <b><a href="#snapshot-state">#snapshot-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-snapshot-state">3. The Blob Interface and Binary Data</a> <a href="#ref-for-snapshot-state①">(2)</a> <a href="#ref-for-snapshot-state②">(3)</a>
    <li><a href="#ref-for-snapshot-state③">4. The File Interface</a> <a href="#ref-for-snapshot-state④">(2)</a> <a href="#ref-for-snapshot-state⑤">(3)</a> <a href="#ref-for-snapshot-state⑥">(4)</a> <a href="#ref-for-snapshot-state⑦">(5)</a> <a href="#ref-for-snapshot-state⑧">(6)</a>
    <li><a href="#ref-for-snapshot-state⑨">7. Errors and Exceptions</a>
    <li><a href="#ref-for-snapshot-state①⓪">7.1. Throwing an Exception or Returning an Error</a> <a href="#ref-for-snapshot-state①①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-Blob">
   <b><a href="#dfn-Blob">#dfn-Blob</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-Blob⑤">1. Introduction</a> <a href="#ref-for-dfn-Blob⑥">(2)</a> <a href="#ref-for-dfn-Blob⑦">(3)</a>
    <li><a href="#ref-for-dfn-Blob⑧">3. The Blob Interface and Binary Data</a> <a href="#ref-for-dfn-Blob⑨">(2)</a> <a href="#ref-for-dfn-Blob①⓪">(3)</a> <a href="#ref-for-dfn-Blob①①">(4)</a> <a href="#ref-for-dfn-Blob①②">(5)</a> <a href="#ref-for-dfn-Blob①③">(6)</a>
    <li><a href="#ref-for-dfn-Blob①④">3.1. Constructors</a> <a href="#ref-for-dfn-Blob①⑤">(2)</a>
    <li><a href="#ref-for-dfn-Blob①⑥">3.1.1. Constructor Parameters</a> <a href="#ref-for-dfn-Blob①⑦">(2)</a> <a href="#ref-for-dfn-Blob①⑧">(3)</a> <a href="#ref-for-dfn-Blob①⑨">(4)</a> <a href="#ref-for-dfn-Blob②⓪">(5)</a> <a href="#ref-for-dfn-Blob②①">(6)</a>
    <li><a href="#ref-for-dfn-Blob②②">3.2. Attributes</a> <a href="#ref-for-dfn-Blob②③">(2)</a> <a href="#ref-for-dfn-Blob②④">(3)</a> <a href="#ref-for-dfn-Blob②⑤">(4)</a> <a href="#ref-for-dfn-Blob②⑥">(5)</a>
    <li><a href="#ref-for-dfn-Blob②⑦">3.3.1. The slice() method</a> <a href="#ref-for-dfn-Blob②⑧">(2)</a> <a href="#ref-for-dfn-Blob②⑨">(3)</a> <a href="#ref-for-dfn-Blob③⓪">(4)</a>
    <li><a href="#ref-for-dfn-Blob③①">4. The File Interface</a> <a href="#ref-for-dfn-Blob③②">(2)</a>
    <li><a href="#ref-for-dfn-Blob③③">4.1.1. Constructor Parameters</a>
    <li><a href="#ref-for-dfn-Blob③④">4.2. Attributes</a>
    <li><a href="#ref-for-dfn-Blob③⑤">6.1. The File Reading Task Source</a>
    <li><a href="#ref-for-dfn-Blob③⑥">6.2. The FileReader API</a> <a href="#ref-for-dfn-Blob③⑦">(2)</a> <a href="#ref-for-dfn-Blob③⑧">(3)</a> <a href="#ref-for-dfn-Blob③⑨">(4)</a>
    <li><a href="#ref-for-dfn-Blob④⓪">6.2.2. FileReader States</a> <a href="#ref-for-dfn-Blob④①">(2)</a> <a href="#ref-for-dfn-Blob④②">(3)</a>
    <li><a href="#ref-for-dfn-Blob④③">6.3. Packaging data</a>
    <li><a href="#ref-for-dfn-Blob④④">6.5. Reading on Threads</a>
    <li><a href="#ref-for-dfn-Blob④⑤">6.5.1. The FileReaderSync API</a> <a href="#ref-for-dfn-Blob④⑥">(2)</a> <a href="#ref-for-dfn-Blob④⑦">(3)</a> <a href="#ref-for-dfn-Blob④⑧">(4)</a> <a href="#ref-for-dfn-Blob④⑨">(5)</a>
    <li><a href="#ref-for-dfn-Blob⑤⓪">7. Errors and Exceptions</a> <a href="#ref-for-dfn-Blob⑤①">(2)</a> <a href="#ref-for-dfn-Blob⑤②">(3)</a>
    <li><a href="#ref-for-dfn-Blob⑤③">7.1. Throwing an Exception or Returning an Error</a> <a href="#ref-for-dfn-Blob⑤④">(2)</a> <a href="#ref-for-dfn-Blob⑤⑤">(3)</a> <a href="#ref-for-dfn-Blob⑤⑥">(4)</a> <a href="#ref-for-dfn-Blob⑤⑦">(5)</a> <a href="#ref-for-dfn-Blob⑤⑧">(6)</a>
    <li><a href="#ref-for-dfn-Blob⑤⑨">8. A URL for Blob and MediaSource reference</a>
    <li><a href="#ref-for-dfn-Blob⑥⓪">8.1. Introduction</a> <a href="#ref-for-dfn-Blob⑥①">(2)</a> <a href="#ref-for-dfn-Blob⑥②">(3)</a>
    <li><a href="#ref-for-dfn-Blob⑥③">8.2. Model</a>
    <li><a href="#ref-for-dfn-Blob⑥④">8.4. Creating and Revoking a blob URL</a>
    <li><a href="#ref-for-dfn-Blob⑥⑤">8.4.1. Examples of blob URL Creation and Revocation</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-blob-blob">
   <b><a href="#dom-blob-blob">#dom-blob-blob</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-blob-blob">3.1. Constructors</a> <a href="#ref-for-dom-blob-blob①">(2)</a>
    <li><a href="#ref-for-dom-blob-blob②">3.1.1. Constructor Parameters</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-blob-blob-blobparts-options-options">
   <b><a href="#dom-blob-blob-blobparts-options-options">#dom-blob-blob-blobparts-options-options</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-blob-blob-blobparts-options-options">3.1. Constructors</a> <a href="#ref-for-dom-blob-blob-blobparts-options-options①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="enumdef-endingtype">
   <b><a href="#enumdef-endingtype">#enumdef-endingtype</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-enumdef-endingtype">3. The Blob Interface and Binary Data</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-endingtype-transparent">
   <b><a href="#dom-endingtype-transparent">#dom-endingtype-transparent</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-endingtype-transparent">3.1.1. Constructor Parameters</a> <a href="#ref-for-dom-endingtype-transparent①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-endingtype-native">
   <b><a href="#dom-endingtype-native">#dom-endingtype-native</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-endingtype-native">3.1.1. Constructor Parameters</a> <a href="#ref-for-dom-endingtype-native①">(2)</a> <a href="#ref-for-dom-endingtype-native②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-BlobPropertyBag">
   <b><a href="#dfn-BlobPropertyBag">#dfn-BlobPropertyBag</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-BlobPropertyBag">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-dfn-BlobPropertyBag①">3.1.1. Constructor Parameters</a> <a href="#ref-for-dfn-BlobPropertyBag②">(2)</a>
    <li><a href="#ref-for-dfn-BlobPropertyBag③">4. The File Interface</a>
    <li><a href="#ref-for-dfn-BlobPropertyBag④">4.1.1. Constructor Parameters</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="typedefdef-blobpart">
   <b><a href="#typedefdef-blobpart">#typedefdef-blobpart</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-typedefdef-blobpart">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-typedefdef-blobpart①">3.1.1. Constructor Parameters</a>
    <li><a href="#ref-for-typedefdef-blobpart②">4. The File Interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="blob-get-stream">
   <b><a href="#blob-get-stream">#blob-get-stream</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-blob-get-stream">3.3.2. The stream() method</a>
    <li><a href="#ref-for-blob-get-stream①">3.3.3. The text() method</a>
    <li><a href="#ref-for-blob-get-stream②">3.3.4. The arrayBuffer() method</a>
    <li><a href="#ref-for-blob-get-stream③">6.2. The FileReader API</a>
    <li><a href="#ref-for-blob-get-stream④">6.5.1.2. The readAsText()</a>
    <li><a href="#ref-for-blob-get-stream⑤">6.5.1.3. The readAsDataURL() method</a>
    <li><a href="#ref-for-blob-get-stream⑥">6.5.1.4. The readAsArrayBuffer() method</a>
    <li><a href="#ref-for-blob-get-stream⑦">6.5.1.5. The readAsBinaryString() method</a>
    <li><a href="#ref-for-blob-get-stream⑧">7.1. Throwing an Exception or Returning an Error</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-blobParts">
   <b><a href="#dfn-blobParts">#dfn-blobParts</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-blobParts">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-dfn-blobParts①">3.1. Constructors</a>
    <li><a href="#ref-for-dfn-blobParts②">3.1.1. Constructor Parameters</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-BPtype">
   <b><a href="#dfn-BPtype">#dfn-BPtype</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-BPtype">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-dfn-BPtype①">3.1. Constructors</a> <a href="#ref-for-dfn-BPtype②">(2)</a>
    <li><a href="#ref-for-dfn-BPtype③">4.1. Constructor</a> <a href="#ref-for-dfn-BPtype④">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-blobpropertybag-endings">
   <b><a href="#dom-blobpropertybag-endings">#dom-blobpropertybag-endings</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-blobpropertybag-endings">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-dom-blobpropertybag-endings①">3.1.1. Constructor Parameters</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="process-blob-parts">
   <b><a href="#process-blob-parts">#process-blob-parts</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-process-blob-parts">3.1. Constructors</a>
    <li><a href="#ref-for-process-blob-parts①">4.1. Constructor</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="convert-line-endings-to-native">
   <b><a href="#convert-line-endings-to-native">#convert-line-endings-to-native</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-convert-line-endings-to-native">3.1.1. Constructor Parameters</a> <a href="#ref-for-convert-line-endings-to-native①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-size">
   <b><a href="#dfn-size">#dfn-size</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-size">3. The Blob Interface and Binary Data</a> <a href="#ref-for-dfn-size①">(2)</a>
    <li><a href="#ref-for-dfn-size②">3.1. Constructors</a> <a href="#ref-for-dfn-size③">(2)</a>
    <li><a href="#ref-for-dfn-size④">3.3.1. The slice() method</a> <a href="#ref-for-dfn-size⑤">(2)</a> <a href="#ref-for-dfn-size⑥">(3)</a>
    <li><a href="#ref-for-dfn-size⑦">4.1. Constructor</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-type">
   <b><a href="#dfn-type">#dfn-type</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-type">3. The Blob Interface and Binary Data</a> <a href="#ref-for-dfn-type①">(2)</a>
    <li><a href="#ref-for-dfn-type②">3.1. Constructors</a> <a href="#ref-for-dfn-type③">(2)</a>
    <li><a href="#ref-for-dfn-type④">3.1.1. Constructor Parameters</a> <a href="#ref-for-dfn-type⑤">(2)</a>
    <li><a href="#ref-for-dfn-type⑥">3.2. Attributes</a> <a href="#ref-for-dfn-type⑦">(2)</a> <a href="#ref-for-dfn-type⑧">(3)</a>
    <li><a href="#ref-for-dfn-type⑨">3.3.1. The slice() method</a> <a href="#ref-for-dfn-type①⓪">(2)</a>
    <li><a href="#ref-for-dfn-type①①">4. The File Interface</a> <a href="#ref-for-dfn-type①②">(2)</a>
    <li><a href="#ref-for-dfn-type①③">4.1. Constructor</a>
    <li><a href="#ref-for-dfn-type①④">6.2. The FileReader API</a>
    <li><a href="#ref-for-dfn-type①⑤">6.3. Packaging data</a>
    <li><a href="#ref-for-dfn-type①⑥">6.5.1.2. The readAsText()</a>
    <li><a href="#ref-for-dfn-type①⑦">6.5.1.3. The readAsDataURL() method</a>
    <li><a href="#ref-for-dfn-type①⑧">6.5.1.4. The readAsArrayBuffer() method</a>
    <li><a href="#ref-for-dfn-type①⑨">6.5.1.5. The readAsBinaryString() method</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-slice">
   <b><a href="#dfn-slice">#dfn-slice</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-slice">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-dfn-slice①">3.2. Attributes</a>
    <li><a href="#ref-for-dfn-slice②">3.3.1. The slice() method</a> <a href="#ref-for-dfn-slice③">(2)</a> <a href="#ref-for-dfn-slice④">(3)</a> <a href="#ref-for-dfn-slice⑤">(4)</a> <a href="#ref-for-dfn-slice⑥">(5)</a> <a href="#ref-for-dfn-slice⑦">(6)</a> <a href="#ref-for-dfn-slice⑧">(7)</a> <a href="#ref-for-dfn-slice⑨">(8)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-start">
   <b><a href="#dfn-start">#dfn-start</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-start">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-dfn-start①">3.3.1. The slice() method</a> <a href="#ref-for-dfn-start②">(2)</a> <a href="#ref-for-dfn-start③">(3)</a> <a href="#ref-for-dfn-start④">(4)</a> <a href="#ref-for-dfn-start⑤">(5)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-end">
   <b><a href="#dfn-end">#dfn-end</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-end">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-dfn-end①">3.3.1. The slice() method</a> <a href="#ref-for-dfn-end②">(2)</a> <a href="#ref-for-dfn-end③">(3)</a> <a href="#ref-for-dfn-end④">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-contentTypeBlob">
   <b><a href="#dfn-contentTypeBlob">#dfn-contentTypeBlob</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-contentTypeBlob">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-dfn-contentTypeBlob①">3.3.1. The slice() method</a> <a href="#ref-for-dfn-contentTypeBlob②">(2)</a> <a href="#ref-for-dfn-contentTypeBlob③">(3)</a> <a href="#ref-for-dfn-contentTypeBlob④">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-blob-stream">
   <b><a href="#dom-blob-stream">#dom-blob-stream</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-blob-stream">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-dom-blob-stream①">3.3.2. The stream() method</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-blob-text">
   <b><a href="#dom-blob-text">#dom-blob-text</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-blob-text">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-dom-blob-text①">3.3.3. The text() method</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-blob-arraybuffer">
   <b><a href="#dom-blob-arraybuffer">#dom-blob-arraybuffer</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-blob-arraybuffer">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-dom-blob-arraybuffer①">3.3.4. The arrayBuffer() method</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="file-type-guidelines">
   <b><a href="#file-type-guidelines">#file-type-guidelines</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-file-type-guidelines">3.2. Attributes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-file">
   <b><a href="#dfn-file">#dfn-file</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-file③">1. Introduction</a> <a href="#ref-for-dfn-file④">(2)</a> <a href="#ref-for-dfn-file⑤">(3)</a>
    <li><a href="#ref-for-dfn-file⑥">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-dfn-file⑦">3.3.1. The slice() method</a> <a href="#ref-for-dfn-file⑧">(2)</a>
    <li><a href="#ref-for-dfn-file⑨">4. The File Interface</a> <a href="#ref-for-dfn-file①⓪">(2)</a> <a href="#ref-for-dfn-file①①">(3)</a> <a href="#ref-for-dfn-file①②">(4)</a> <a href="#ref-for-dfn-file①③">(5)</a> <a href="#ref-for-dfn-file①④">(6)</a> <a href="#ref-for-dfn-file①⑤">(7)</a>
    <li><a href="#ref-for-dfn-file①⑥">4.1. Constructor</a> <a href="#ref-for-dfn-file①⑦">(2)</a>
    <li><a href="#ref-for-dfn-file①⑧">4.1.1. Constructor Parameters</a>
    <li><a href="#ref-for-dfn-file①⑨">4.2. Attributes</a> <a href="#ref-for-dfn-file②⓪">(2)</a> <a href="#ref-for-dfn-file②①">(3)</a> <a href="#ref-for-dfn-file②②">(4)</a>
    <li><a href="#ref-for-dfn-file②③">5. The FileList Interface</a> <a href="#ref-for-dfn-file②④">(2)</a>
    <li><a href="#ref-for-dfn-file②⑤">5.2. Methods and Parameters</a> <a href="#ref-for-dfn-file②⑥">(2)</a> <a href="#ref-for-dfn-file②⑦">(3)</a> <a href="#ref-for-dfn-file②⑧">(4)</a> <a href="#ref-for-dfn-file②⑨">(5)</a>
    <li><a href="#ref-for-dfn-file③⓪">6.1. The File Reading Task Source</a>
    <li><a href="#ref-for-dfn-file③①">6.2.2. FileReader States</a> <a href="#ref-for-dfn-file③②">(2)</a> <a href="#ref-for-dfn-file③③">(3)</a>
    <li><a href="#ref-for-dfn-file③④">6.5. Reading on Threads</a>
    <li><a href="#ref-for-dfn-file③⑤">6.5.1. The FileReaderSync API</a>
    <li><a href="#ref-for-dfn-file③⑥">7. Errors and Exceptions</a> <a href="#ref-for-dfn-file③⑦">(2)</a> <a href="#ref-for-dfn-file③⑧">(3)</a>
    <li><a href="#ref-for-dfn-file③⑨">7.1. Throwing an Exception or Returning an Error</a> <a href="#ref-for-dfn-file④⓪">(2)</a> <a href="#ref-for-dfn-file④①">(3)</a> <a href="#ref-for-dfn-file④②">(4)</a> <a href="#ref-for-dfn-file④③">(5)</a> <a href="#ref-for-dfn-file④④">(6)</a>
    <li><a href="#ref-for-dfn-file④⑤">10. Requirements and Use Cases</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-file-file">
   <b><a href="#dom-file-file">#dom-file-file</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-file-file">4.1. Constructor</a>
    <li><a href="#ref-for-dom-file-file①">4.1.1. Constructor Parameters</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-file-file-filebits-filename-options-options">
   <b><a href="#dom-file-file-filebits-filename-options-options">#dom-file-file-filebits-filename-options-options</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-file-file-filebits-filename-options-options">4.1. Constructor</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-FilePropertyBag">
   <b><a href="#dfn-FilePropertyBag">#dfn-FilePropertyBag</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-FilePropertyBag">4. The File Interface</a>
    <li><a href="#ref-for-dfn-FilePropertyBag①">4.1. Constructor</a>
    <li><a href="#ref-for-dfn-FilePropertyBag②">4.1.1. Constructor Parameters</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-fileBits">
   <b><a href="#dfn-fileBits">#dfn-fileBits</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-fileBits">4. The File Interface</a>
    <li><a href="#ref-for-dfn-fileBits①">4.1. Constructor</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-fileName">
   <b><a href="#dfn-fileName">#dfn-fileName</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-fileName">4. The File Interface</a>
    <li><a href="#ref-for-dfn-fileName①">4.1. Constructor</a> <a href="#ref-for-dfn-fileName②">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-FPdate">
   <b><a href="#dfn-FPdate">#dfn-FPdate</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-FPdate">4. The File Interface</a>
    <li><a href="#ref-for-dfn-FPdate①">4.1. Constructor</a> <a href="#ref-for-dfn-FPdate②">(2)</a> <a href="#ref-for-dfn-FPdate③">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-name">
   <b><a href="#dfn-name">#dfn-name</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-name">4. The File Interface</a> <a href="#ref-for-dfn-name①">(2)</a> <a href="#ref-for-dfn-name②">(3)</a> <a href="#ref-for-dfn-name③">(4)</a>
    <li><a href="#ref-for-dfn-name④">4.1. Constructor</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-lastModified">
   <b><a href="#dfn-lastModified">#dfn-lastModified</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-lastModified">4. The File Interface</a> <a href="#ref-for-dfn-lastModified①">(2)</a> <a href="#ref-for-dfn-lastModified②">(3)</a>
    <li><a href="#ref-for-dfn-lastModified③">4.1. Constructor</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-filelist">
   <b><a href="#dfn-filelist">#dfn-filelist</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-filelist①">4.2. Attributes</a>
    <li><a href="#ref-for-dfn-filelist②">5. The FileList Interface</a> <a href="#ref-for-dfn-filelist③">(2)</a> <a href="#ref-for-dfn-filelist④">(3)</a>
    <li><a href="#ref-for-dfn-filelist⑤">5.1. Attributes</a>
    <li><a href="#ref-for-dfn-filelist⑥">5.2. Methods and Parameters</a> <a href="#ref-for-dfn-filelist⑦">(2)</a> <a href="#ref-for-dfn-filelist⑧">(3)</a> <a href="#ref-for-dfn-filelist⑨">(4)</a> <a href="#ref-for-dfn-filelist①⓪">(5)</a> <a href="#ref-for-dfn-filelist①①">(6)</a>
    <li><a href="#ref-for-dfn-filelist①②">9. Security and Privacy Considerations</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-length">
   <b><a href="#dfn-length">#dfn-length</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-length">5. The FileList Interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-item">
   <b><a href="#dfn-item">#dfn-item</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-item">5. The FileList Interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-index">
   <b><a href="#dfn-index">#dfn-index</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-index">5. The FileList Interface</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="fileReadingTaskSource">
   <b><a href="#fileReadingTaskSource">#fileReadingTaskSource</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-fileReadingTaskSource">6.2. The FileReader API</a>
    <li><a href="#ref-for-fileReadingTaskSource①">6.2.3.5. The abort() method</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-filereader">
   <b><a href="#dfn-filereader">#dfn-filereader</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-filereader①">1. Introduction</a>
    <li><a href="#ref-for-dfn-filereader②">3.2. Attributes</a>
    <li><a href="#ref-for-dfn-filereader③">3.3.3. The text() method</a>
    <li><a href="#ref-for-dfn-filereader④">6.2. The FileReader API</a> <a href="#ref-for-dfn-filereader⑤">(2)</a> <a href="#ref-for-dfn-filereader⑥">(3)</a> <a href="#ref-for-dfn-filereader⑦">(4)</a> <a href="#ref-for-dfn-filereader⑧">(5)</a> <a href="#ref-for-dfn-filereader⑨">(6)</a>
    <li><a href="#ref-for-dfn-filereader①⓪">6.2.1. Event Handler Content Attributes</a>
    <li><a href="#ref-for-dfn-filereader①①">6.2.2. FileReader States</a> <a href="#ref-for-dfn-filereader①②">(2)</a> <a href="#ref-for-dfn-filereader①③">(3)</a> <a href="#ref-for-dfn-filereader①④">(4)</a> <a href="#ref-for-dfn-filereader①⑤">(5)</a>
    <li><a href="#ref-for-dfn-filereader①⑥">6.2.3. Reading a File or Blob</a> <a href="#ref-for-dfn-filereader①⑦">(2)</a> <a href="#ref-for-dfn-filereader①⑧">(3)</a>
    <li><a href="#ref-for-dfn-filereader①⑨">6.4. Events</a> <a href="#ref-for-dfn-filereader②⓪">(2)</a>
    <li><a href="#ref-for-dfn-filereader②①">6.4.1. Event Summary</a>
    <li><a href="#ref-for-dfn-filereader②②">6.5. Reading on Threads</a>
    <li><a href="#ref-for-dfn-filereader②③">7.1. Throwing an Exception or Returning an Error</a>
    <li><a href="#ref-for-dfn-filereader②④">9. Security and Privacy Considerations</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-filereader-empty">
   <b><a href="#dom-filereader-empty">#dom-filereader-empty</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-filereader-empty">6.2. The FileReader API</a>
    <li><a href="#ref-for-dom-filereader-empty①">6.2.2. FileReader States</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-filereader-loading">
   <b><a href="#dom-filereader-loading">#dom-filereader-loading</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-filereader-loading">6.2. The FileReader API</a>
    <li><a href="#ref-for-dom-filereader-loading①">6.2.2. FileReader States</a>
    <li><a href="#ref-for-dom-filereader-loading②">6.2.3. Reading a File or Blob</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-filereader-done">
   <b><a href="#dom-filereader-done">#dom-filereader-done</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-filereader-done">6.2. The FileReader API</a>
    <li><a href="#ref-for-dom-filereader-done①">6.2.2. FileReader States</a> <a href="#ref-for-dom-filereader-done②">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="filereader-state">
   <b><a href="#filereader-state">#filereader-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-filereader-state">6.2. The FileReader API</a> <a href="#ref-for-filereader-state①">(2)</a> <a href="#ref-for-filereader-state②">(3)</a> <a href="#ref-for-filereader-state③">(4)</a> <a href="#ref-for-filereader-state④">(5)</a> <a href="#ref-for-filereader-state⑤">(6)</a> <a href="#ref-for-filereader-state⑥">(7)</a>
    <li><a href="#ref-for-filereader-state⑦">6.2.3.5. The abort() method</a> <a href="#ref-for-filereader-state⑧">(2)</a> <a href="#ref-for-filereader-state⑨">(3)</a> <a href="#ref-for-filereader-state①⓪">(4)</a> <a href="#ref-for-filereader-state①①">(5)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="filereader-result">
   <b><a href="#filereader-result">#filereader-result</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-filereader-result">6.2. The FileReader API</a> <a href="#ref-for-filereader-result①">(2)</a> <a href="#ref-for-filereader-result②">(3)</a>
    <li><a href="#ref-for-filereader-result③">6.2.3.5. The abort() method</a> <a href="#ref-for-filereader-result④">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="filereader-error">
   <b><a href="#filereader-error">#filereader-error</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-filereader-error">6.2. The FileReader API</a> <a href="#ref-for-filereader-error①">(2)</a> <a href="#ref-for-filereader-error②">(3)</a> <a href="#ref-for-filereader-error③">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="filereaderConstrctr">
   <b><a href="#filereaderConstrctr">#filereaderConstrctr</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-filereaderConstrctr">6.2. The FileReader API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-filereader-readystate">
   <b><a href="#dom-filereader-readystate">#dom-filereader-readystate</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-filereader-readystate">6.2. The FileReader API</a>
    <li><a href="#ref-for-dom-filereader-readystate①">6.2.2. FileReader States</a> <a href="#ref-for-dom-filereader-readystate②">(2)</a>
    <li><a href="#ref-for-dom-filereader-readystate③">6.2.3. Reading a File or Blob</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-filereader-result">
   <b><a href="#dom-filereader-result">#dom-filereader-result</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-filereader-result">6.2. The FileReader API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-filereader-error">
   <b><a href="#dom-filereader-error">#dom-filereader-error</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-filereader-error">4.2. Attributes</a>
    <li><a href="#ref-for-dom-filereader-error①">6.2. The FileReader API</a>
    <li><a href="#ref-for-dom-filereader-error②">7.1. Throwing an Exception or Returning an Error</a> <a href="#ref-for-dom-filereader-error③">(2)</a> <a href="#ref-for-dom-filereader-error④">(3)</a> <a href="#ref-for-dom-filereader-error⑤">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="readOperation">
   <b><a href="#readOperation">#readOperation</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-readOperation">4.2. Attributes</a>
    <li><a href="#ref-for-readOperation①">6.2.3.1. The readAsDataURL() method</a>
    <li><a href="#ref-for-readOperation②">6.2.3.2. The readAsText() method</a>
    <li><a href="#ref-for-readOperation③">6.2.3.3. The readAsArrayBuffer()</a>
    <li><a href="#ref-for-readOperation④">6.2.3.4. The readAsBinaryString() method</a>
    <li><a href="#ref-for-readOperation⑤">7.1. Throwing an Exception or Returning an Error</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-onloadstart">
   <b><a href="#dfn-onloadstart">#dfn-onloadstart</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-onloadstart">6.2. The FileReader API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-onprogress">
   <b><a href="#dfn-onprogress">#dfn-onprogress</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-onprogress">6.2. The FileReader API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-onabort">
   <b><a href="#dfn-onabort">#dfn-onabort</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-onabort">6.2. The FileReader API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-onerror">
   <b><a href="#dfn-onerror">#dfn-onerror</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-onerror">6.2. The FileReader API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-onload">
   <b><a href="#dfn-onload">#dfn-onload</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-onload">6.2. The FileReader API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-onloadend">
   <b><a href="#dfn-onloadend">#dfn-onloadend</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-onloadend">6.2. The FileReader API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="asynchronous-read-methods">
   <b><a href="#asynchronous-read-methods">#asynchronous-read-methods</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-asynchronous-read-methods">7. Errors and Exceptions</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="read-method">
   <b><a href="#read-method">#read-method</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-read-method">2. Terminology and Algorithms</a>
    <li><a href="#ref-for-read-method①">6.2.2. FileReader States</a> <a href="#ref-for-read-method②">(2)</a> <a href="#ref-for-read-method③">(3)</a> <a href="#ref-for-read-method④">(4)</a>
    <li><a href="#ref-for-read-method⑤">6.2.3.5. The abort() method</a>
    <li><a href="#ref-for-read-method⑥">6.4.2. Summary of Event Invariants</a> <a href="#ref-for-read-method⑦">(2)</a> <a href="#ref-for-read-method⑧">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-readAsDataURL">
   <b><a href="#dfn-readAsDataURL">#dfn-readAsDataURL</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-readAsDataURL">6.2. The FileReader API</a>
    <li><a href="#ref-for-dfn-readAsDataURL①">6.2.3. Reading a File or Blob</a>
    <li><a href="#ref-for-dfn-readAsDataURL②">6.2.3.1. The readAsDataURL() method</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-readAsText">
   <b><a href="#dfn-readAsText">#dfn-readAsText</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-readAsText">3.3.3. The text() method</a>
    <li><a href="#ref-for-dfn-readAsText①">6.2. The FileReader API</a>
    <li><a href="#ref-for-dfn-readAsText②">6.2.3. Reading a File or Blob</a>
    <li><a href="#ref-for-dfn-readAsText③">6.2.3.2. The readAsText() method</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-readAsArrayBuffer">
   <b><a href="#dfn-readAsArrayBuffer">#dfn-readAsArrayBuffer</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-readAsArrayBuffer">6.2. The FileReader API</a>
    <li><a href="#ref-for-dfn-readAsArrayBuffer①">6.2.3. Reading a File or Blob</a>
    <li><a href="#ref-for-dfn-readAsArrayBuffer②">6.2.3.3. The readAsArrayBuffer()</a>
    <li><a href="#ref-for-dfn-readAsArrayBuffer③">6.2.3.4. The readAsBinaryString() method</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-readAsBinaryString">
   <b><a href="#dfn-readAsBinaryString">#dfn-readAsBinaryString</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-readAsBinaryString">6.2. The FileReader API</a>
    <li><a href="#ref-for-dfn-readAsBinaryString①">6.2.3. Reading a File or Blob</a>
    <li><a href="#ref-for-dfn-readAsBinaryString②">6.2.3.4. The readAsBinaryString() method</a> <a href="#ref-for-dfn-readAsBinaryString③">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-abort">
   <b><a href="#dfn-abort">#dfn-abort</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-abort">2. Terminology and Algorithms</a>
    <li><a href="#ref-for-dfn-abort①">6.2. The FileReader API</a>
    <li><a href="#ref-for-dfn-abort②">6.2.2. FileReader States</a>
    <li><a href="#ref-for-dfn-abort③">6.2.3.5. The abort() method</a>
    <li><a href="#ref-for-dfn-abort④">6.4.1. Event Summary</a>
    <li><a href="#ref-for-dfn-abort⑤">6.4.2. Summary of Event Invariants</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="blob-package-data">
   <b><a href="#blob-package-data">#blob-package-data</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-blob-package-data">3.2. Attributes</a>
    <li><a href="#ref-for-blob-package-data①">6.2. The FileReader API</a> <a href="#ref-for-blob-package-data②">(2)</a>
    <li><a href="#ref-for-blob-package-data③">6.5.1.2. The readAsText()</a>
    <li><a href="#ref-for-blob-package-data④">6.5.1.3. The readAsDataURL() method</a>
    <li><a href="#ref-for-blob-package-data⑤">6.5.1.4. The readAsArrayBuffer() method</a>
    <li><a href="#ref-for-blob-package-data⑥">6.5.1.5. The readAsBinaryString() method</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="fire-a-progress-event">
   <b><a href="#fire-a-progress-event">#fire-a-progress-event</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-fire-a-progress-event">6.2. The FileReader API</a> <a href="#ref-for-fire-a-progress-event①">(2)</a> <a href="#ref-for-fire-a-progress-event②">(3)</a> <a href="#ref-for-fire-a-progress-event③">(4)</a> <a href="#ref-for-fire-a-progress-event④">(5)</a> <a href="#ref-for-fire-a-progress-event⑤">(6)</a> <a href="#ref-for-fire-a-progress-event⑥">(7)</a>
    <li><a href="#ref-for-fire-a-progress-event⑦">6.2.3.5. The abort() method</a> <a href="#ref-for-fire-a-progress-event⑧">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-loadstart-event">
   <b><a href="#dfn-loadstart-event">#dfn-loadstart-event</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-loadstart-event">6.2. The FileReader API</a> <a href="#ref-for-dfn-loadstart-event①">(2)</a>
    <li><a href="#ref-for-dfn-loadstart-event②">6.2.1. Event Handler Content Attributes</a>
    <li><a href="#ref-for-dfn-loadstart-event③">6.4.2. Summary of Event Invariants</a> <a href="#ref-for-dfn-loadstart-event④">(2)</a> <a href="#ref-for-dfn-loadstart-event⑤">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-progress-event">
   <b><a href="#dfn-progress-event">#dfn-progress-event</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-progress-event">6.2. The FileReader API</a>
    <li><a href="#ref-for-dfn-progress-event①">6.2.1. Event Handler Content Attributes</a>
    <li><a href="#ref-for-dfn-progress-event②">6.4.2. Summary of Event Invariants</a> <a href="#ref-for-dfn-progress-event③">(2)</a> <a href="#ref-for-dfn-progress-event④">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-abort-event">
   <b><a href="#dfn-abort-event">#dfn-abort-event</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-abort-event">6.2.1. Event Handler Content Attributes</a>
    <li><a href="#ref-for-dfn-abort-event①">6.2.3.5. The abort() method</a>
    <li><a href="#ref-for-dfn-abort-event②">6.4.2. Summary of Event Invariants</a> <a href="#ref-for-dfn-abort-event③">(2)</a> <a href="#ref-for-dfn-abort-event④">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-error-event">
   <b><a href="#dfn-error-event">#dfn-error-event</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-error-event">4.2. Attributes</a>
    <li><a href="#ref-for-dfn-error-event①">6.2. The FileReader API</a> <a href="#ref-for-dfn-error-event②">(2)</a> <a href="#ref-for-dfn-error-event③">(3)</a> <a href="#ref-for-dfn-error-event④">(4)</a>
    <li><a href="#ref-for-dfn-error-event⑤">6.2.1. Event Handler Content Attributes</a>
    <li><a href="#ref-for-dfn-error-event⑥">6.4.2. Summary of Event Invariants</a> <a href="#ref-for-dfn-error-event⑦">(2)</a> <a href="#ref-for-dfn-error-event⑧">(3)</a> <a href="#ref-for-dfn-error-event⑨">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-load-event">
   <b><a href="#dfn-load-event">#dfn-load-event</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-load-event">6.2. The FileReader API</a> <a href="#ref-for-dfn-load-event①">(2)</a>
    <li><a href="#ref-for-dfn-load-event②">6.2.1. Event Handler Content Attributes</a>
    <li><a href="#ref-for-dfn-load-event③">6.4.2. Summary of Event Invariants</a> <a href="#ref-for-dfn-load-event④">(2)</a> <a href="#ref-for-dfn-load-event⑤">(3)</a> <a href="#ref-for-dfn-load-event⑥">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-loadend-event">
   <b><a href="#dfn-loadend-event">#dfn-loadend-event</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-loadend-event">6.2. The FileReader API</a> <a href="#ref-for-dfn-loadend-event①">(2)</a> <a href="#ref-for-dfn-loadend-event②">(3)</a> <a href="#ref-for-dfn-loadend-event③">(4)</a>
    <li><a href="#ref-for-dfn-loadend-event④">6.2.1. Event Handler Content Attributes</a>
    <li><a href="#ref-for-dfn-loadend-event⑤">6.2.3.5. The abort() method</a>
    <li><a href="#ref-for-dfn-loadend-event⑥">6.4.2. Summary of Event Invariants</a> <a href="#ref-for-dfn-loadend-event⑦">(2)</a> <a href="#ref-for-dfn-loadend-event⑧">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="read-method-sync">
   <b><a href="#read-method-sync">#read-method-sync</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-read-method-sync">6.2.3. Reading a File or Blob</a>
    <li><a href="#ref-for-read-method-sync①">7. Errors and Exceptions</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-FileReaderSync">
   <b><a href="#dfn-FileReaderSync">#dfn-FileReaderSync</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-FileReaderSync">3.2. Attributes</a>
    <li><a href="#ref-for-dfn-FileReaderSync①">4.2. Attributes</a>
    <li><a href="#ref-for-dfn-FileReaderSync②">6.2.3. Reading a File or Blob</a> <a href="#ref-for-dfn-FileReaderSync③">(2)</a>
    <li><a href="#ref-for-dfn-FileReaderSync④">6.5. Reading on Threads</a>
    <li><a href="#ref-for-dfn-FileReaderSync⑤">6.5.1. The FileReaderSync API</a>
    <li><a href="#ref-for-dfn-FileReaderSync⑥">6.5.1.1. Constructors</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-filereadersync-filereadersync">
   <b><a href="#dom-filereadersync-filereadersync">#dom-filereadersync-filereadersync</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-filereadersync-filereadersync">6.5.1.1. Constructors</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-readAsTextSync">
   <b><a href="#dfn-readAsTextSync">#dfn-readAsTextSync</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-readAsTextSync">6.5.1. The FileReaderSync API</a>
    <li><a href="#ref-for-dfn-readAsTextSync①">6.5.1.2. The readAsText()</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-readAsDataURLSync">
   <b><a href="#dfn-readAsDataURLSync">#dfn-readAsDataURLSync</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-readAsDataURLSync">6.5.1. The FileReaderSync API</a>
    <li><a href="#ref-for-dfn-readAsDataURLSync①">6.5.1.3. The readAsDataURL() method</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-readAsArrayBufferSync">
   <b><a href="#dfn-readAsArrayBufferSync">#dfn-readAsArrayBufferSync</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-readAsArrayBufferSync">6.5.1. The FileReaderSync API</a>
    <li><a href="#ref-for-dfn-readAsArrayBufferSync①">6.5.1.4. The readAsArrayBuffer() method</a>
    <li><a href="#ref-for-dfn-readAsArrayBufferSync②">6.5.1.5. The readAsBinaryString() method</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-readAsBinaryStringSync">
   <b><a href="#dfn-readAsBinaryStringSync">#dfn-readAsBinaryStringSync</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-readAsBinaryStringSync">6.5.1. The FileReaderSync API</a>
    <li><a href="#ref-for-dfn-readAsBinaryStringSync①">6.5.1.5. The readAsBinaryString() method</a> <a href="#ref-for-dfn-readAsBinaryStringSync②">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="file-error-read">
   <b><a href="#file-error-read">#file-error-read</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-file-error-read">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-file-error-read①">4.2. Attributes</a>
    <li><a href="#ref-for-file-error-read②">6.2.2. FileReader States</a>
    <li><a href="#ref-for-file-error-read③">6.4.1. Event Summary</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="failureReason">
   <b><a href="#failureReason">#failureReason</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-failureReason">3. The Blob Interface and Binary Data</a>
    <li><a href="#ref-for-failureReason①">7.1. Throwing an Exception or Returning an Error</a> <a href="#ref-for-failureReason②">(2)</a> <a href="#ref-for-failureReason③">(3)</a> <a href="#ref-for-failureReason④">(4)</a> <a href="#ref-for-failureReason⑤">(5)</a> <a href="#ref-for-failureReason⑥">(6)</a> <a href="#ref-for-failureReason⑦">(7)</a> <a href="#ref-for-failureReason⑧">(8)</a> <a href="#ref-for-failureReason⑨">(9)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="NotFoundFR">
   <b><a href="#NotFoundFR">#NotFoundFR</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-NotFoundFR">7.1. Throwing an Exception or Returning an Error</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="UnsafeFileFR">
   <b><a href="#UnsafeFileFR">#UnsafeFileFR</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-UnsafeFileFR">7.1. Throwing an Exception or Returning an Error</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="TooManyReadsFR">
   <b><a href="#TooManyReadsFR">#TooManyReadsFR</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-TooManyReadsFR">7.1. Throwing an Exception or Returning an Error</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="SnapshotStateFR">
   <b><a href="#SnapshotStateFR">#SnapshotStateFR</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-SnapshotStateFR">7.1. Throwing an Exception or Returning an Error</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="FileLockFR">
   <b><a href="#FileLockFR">#FileLockFR</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-FileLockFR">7.1. Throwing an Exception or Returning an Error</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="BlobURLStore">
   <b><a href="#BlobURLStore">#BlobURLStore</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-BlobURLStore">8.2. Model</a> <a href="#ref-for-BlobURLStore①">(2)</a> <a href="#ref-for-BlobURLStore②">(3)</a> <a href="#ref-for-BlobURLStore③">(4)</a>
    <li><a href="#ref-for-BlobURLStore④">8.3. Dereferencing Model for blob URLs</a>
    <li><a href="#ref-for-BlobURLStore⑤">8.3.1. Origin of blob URLs</a>
    <li><a href="#ref-for-BlobURLStore⑥">8.3.2. Lifetime of blob URLs</a>
    <li><a href="#ref-for-BlobURLStore⑦">8.4. Creating and Revoking a blob URL</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="blob-url-entry">
   <b><a href="#blob-url-entry">#blob-url-entry</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-blob-url-entry">8.2. Model</a> <a href="#ref-for-blob-url-entry①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="blob-url-entry-environment">
   <b><a href="#blob-url-entry-environment">#blob-url-entry-environment</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-blob-url-entry-environment">8.3.2. Lifetime of blob URLs</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="blob-url">
   <b><a href="#blob-url">#blob-url</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-blob-url">3.2. Attributes</a>
    <li><a href="#ref-for-blob-url①">8.1. Introduction</a> <a href="#ref-for-blob-url②">(2)</a>
    <li><a href="#ref-for-blob-url③">8.3. Dereferencing Model for blob URLs</a>
    <li><a href="#ref-for-blob-url④">8.4. Creating and Revoking a blob URL</a> <a href="#ref-for-blob-url⑤">(2)</a> <a href="#ref-for-blob-url⑥">(3)</a> <a href="#ref-for-blob-url⑦">(4)</a>
    <li><a href="#ref-for-blob-url⑧">8.4.1. Examples of blob URL Creation and Revocation</a> <a href="#ref-for-blob-url⑨">(2)</a> <a href="#ref-for-blob-url①⓪">(3)</a> <a href="#ref-for-blob-url①①">(4)</a> <a href="#ref-for-blob-url①②">(5)</a> <a href="#ref-for-blob-url①③">(6)</a>
    <li><a href="#ref-for-blob-url①④">9. Security and Privacy Considerations</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="unicodeBlobURL">
   <b><a href="#unicodeBlobURL">#unicodeBlobURL</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-unicodeBlobURL">8.2. Model</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="add-an-entry">
   <b><a href="#add-an-entry">#add-an-entry</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-add-an-entry">8.4. Creating and Revoking a blob URL</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="removeTheEntry">
   <b><a href="#removeTheEntry">#removeTheEntry</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-removeTheEntry">8.4. Creating and Revoking a blob URL</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="lifeTime">
   <b><a href="#lifeTime">#lifeTime</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-lifeTime">8.4.1. Examples of blob URL Creation and Revocation</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-createObjectURL">
   <b><a href="#dfn-createObjectURL">#dfn-createObjectURL</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-createObjectURL">8.1. Introduction</a>
    <li><a href="#ref-for-dfn-createObjectURL①">8.4. Creating and Revoking a blob URL</a>
    <li><a href="#ref-for-dfn-createObjectURL②">8.4.1. Examples of blob URL Creation and Revocation</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dfn-revokeObjectURL">
   <b><a href="#dfn-revokeObjectURL">#dfn-revokeObjectURL</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-revokeObjectURL">8.1. Introduction</a>
    <li><a href="#ref-for-dfn-revokeObjectURL①">8.4. Creating and Revoking a blob URL</a> <a href="#ref-for-dfn-revokeObjectURL②">(2)</a>
    <li><a href="#ref-for-dfn-revokeObjectURL③">8.4.1. Examples of blob URL Creation and Revocation</a> <a href="#ref-for-dfn-revokeObjectURL④">(2)</a>
   </ul>
  </aside>
<script>/* script-var-click-highlighting */

    document.addEventListener("click", e=>{
        if(e.target.nodeName == "VAR") {
            highlightSameAlgoVars(e.target);
        }
    });
    {
        const indexCounts = new Map();
        const indexNames = new Map();
        function highlightSameAlgoVars(v) {
            // Find the algorithm container.
            let algoContainer = null;
            let searchEl = v;
            while(algoContainer == null && searchEl != document.body) {
                searchEl = searchEl.parentNode;
                if(searchEl.hasAttribute("data-algorithm")) {
                    algoContainer = searchEl;
                }
            }

            // Not highlighting document-global vars,
            // too likely to be unrelated.
            if(algoContainer == null) return;

            const algoName = algoContainer.getAttribute("data-algorithm");
            const varName = getVarName(v);
            const addClass = !v.classList.contains("selected");
            let highlightClass = null;
            if(addClass) {
                const index = chooseHighlightIndex(algoName, varName);
                indexCounts.get(algoName)[index] += 1;
                indexNames.set(algoName+"///"+varName, index);
                highlightClass = nameFromIndex(index);
            } else {
                const index = previousHighlightIndex(algoName, varName);
                indexCounts.get(algoName)[index] -= 1;
                highlightClass = nameFromIndex(index);
            }

            // Find all same-name vars, and toggle their class appropriately.
            for(const el of algoContainer.querySelectorAll("var")) {
                if(getVarName(el) == varName) {
                    el.classList.toggle("selected", addClass);
                    el.classList.toggle(highlightClass, addClass);
                }
            }
        }
        function getVarName(el) {
            return el.textContent.replace(/(\s| )+/, " ").trim();
        }
        function chooseHighlightIndex(algoName, varName) {
            let indexes = null;
            if(indexCounts.has(algoName)) {
                indexes = indexCounts.get(algoName);
            } else {
                // 7 classes right now
                indexes = [0,0,0,0,0,0,0];
                indexCounts.set(algoName, indexes);
            }

            // If the element was recently unclicked,
            // *and* that color is still unclaimed,
            // give it back the same color.
            const lastIndex = previousHighlightIndex(algoName, varName);
            if(indexes[lastIndex] === 0) return lastIndex;

            // Find the earliest index with the lowest count.
            const minCount = Math.min.apply(null, indexes);
            let index = null;
            for(var i = 0; i < indexes.length; i++) {
                if(indexes[i] == minCount) {
                    return i;
                }
            }
        }
        function previousHighlightIndex(algoName, varName) {
            return indexNames.get(algoName+"///"+varName);
        }
        function nameFromIndex(index) {
            return "selected" + index;
        }
    }
    </script>
<script>/* script-dfn-panel */

document.body.addEventListener("click", function(e) {
    var queryAll = function(sel) { return [].slice.call(document.querySelectorAll(sel)); }
    // Find the dfn element or panel, if any, that was clicked on.
    var el = e.target;
    var target;
    var hitALink = false;
    while(el.parentElement) {
        if(el.tagName == "A") {
            // Clicking on a link in a <dfn> shouldn't summon the panel
            hitALink = true;
        }
        if(el.classList.contains("dfn-paneled")) {
            target = "dfn";
            break;
        }
        if(el.classList.contains("dfn-panel")) {
            target = "dfn-panel";
            break;
        }
        el = el.parentElement;
    }
    if(target != "dfn-panel") {
        // Turn off any currently "on" or "activated" panels.
        queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(function(el){
            el.classList.remove("on");
            el.classList.remove("activated");
        });
    }
    if(target == "dfn" && !hitALink) {
        // open the panel
        var dfnPanel = document.querySelector(".dfn-panel[data-for='" + el.id + "']");
        if(dfnPanel) {
            dfnPanel.classList.add("on");
            var rect = el.getBoundingClientRect();
            dfnPanel.style.left = window.scrollX + rect.right + 5 + "px";
            dfnPanel.style.top = window.scrollY + rect.top + "px";
            var panelRect = dfnPanel.getBoundingClientRect();
            var panelWidth = panelRect.right - panelRect.left;
            if(panelRect.right > document.body.scrollWidth && (rect.left - (panelWidth + 5)) > 0) {
                // Reposition, because the panel is overflowing
                dfnPanel.style.left = window.scrollX + rect.left - (panelWidth + 5) + "px";
            }
        } else {
            console.log("Couldn't find .dfn-panel[data-for='" + el.id + "']");
        }
    } else if(target == "dfn-panel") {
        // Switch it to "activated" state, which pins it.
        el.classList.add("activated");
        el.style.left = null;
        el.style.top = null;
    }

});
</script>